Last active
April 9, 2019 18:20
-
-
Save mikaelhadler/f2be4dfdd688b51a3683785cf68593eb 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 axios from 'axios' | |
axios.interceptors.request.use(function (config) { | |
// Do something before request is sent | |
return config | |
}, function (error) { | |
// Do something with request error | |
console.log('Request error: ', error) | |
return Promise.reject(error) | |
}) | |
axios.interceptors.response.use(function (response) { | |
// Do something with response data | |
console.log('Response OK: ', response) | |
return response | |
}, function (error) { | |
// Do something with response error | |
console.log('Error: ', error) | |
return Promise.reject(error) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment