Created
January 28, 2018 01:07
-
-
Save wwwmarcos/24ab0333984ea7718166567e9f70595a 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
// services/http.js | |
import axios from 'axios' | |
import storage from './storage' | |
const transformRequest = (data, headers) => { | |
headers['x-api-token'] = storage.getToken() | |
return data | |
} | |
const configuredAxios = axios.create({ | |
baseURL: 'https://dogs.com/', | |
headers: {'X-Custom-Header': 'foobar'}, | |
transformRequest: [transformRequest] | |
}) | |
export default configuredAxios |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment