Skip to content

Instantly share code, notes, and snippets.

@Nilanth

Nilanth/.jsx Secret

Created July 10, 2021 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nilanth/52077ebaf55edbd165fe77ae55146375 to your computer and use it in GitHub Desktop.
Save Nilanth/52077ebaf55edbd165fe77ae55146375 to your computer and use it in GitHub Desktop.
axios.interceptors.response.use(function (response) {
//Dispatch any action on success
return response;
}, function (error) {
if(error.response.status === 401) {
//Add Logic to
//1. Redirect to login page or
//2. Request refresh token
}
return Promise.reject(error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment