Skip to content

Instantly share code, notes, and snippets.

@sabesansathananthan
Created February 9, 2021 11:13
Show Gist options
  • Save sabesansathananthan/a2919af72c3dbbc33dda818ba26f1461 to your computer and use it in GitHub Desktop.
Save sabesansathananthan/a2919af72c3dbbc33dda818ba26f1461 to your computer and use it in GitHub Desktop.
Axios Vs Fetch
// 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