Created
February 9, 2021 11:13
-
-
Save sabesansathananthan/a2919af72c3dbbc33dda818ba26f1461 to your computer and use it in GitHub Desktop.
Axios Vs Fetch
This file contains hidden or 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
// request interceptors | |
axios.interceptors.request.use((config)=>{ | |
console.log('Request was sent'); | |
return config; | |
}) | |
// response interceptors | |
axios.interceptors.response.use((response) => { | |
// do an operation on response | |
return response; | |
}) | |
axios.get('url') | |
.then((response)=>console.log(response)) | |
.catch((error)=>console.log(error)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment