Last active
September 5, 2018 08:24
-
-
Save ChettaDarkkill/9555c001e8f3a2440a27425072cb5f62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { AsyncStorage } from 'react-native'; | |
import axios from 'axios' | |
import join from 'url-join' | |
axios.interceptors.request.use(async (config)=> { | |
const jwtToken = await AsyncStorage.getItem("token") | |
if (jwtToken != null) { | |
config.headers = { 'x-access-token': jwtToken } | |
} | |
config.url = join('http://demo.com/api/v1', config.url); | |
return config; | |
}); | |
export const httpClient = axios |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment