Forked from yajra/axios-401-response-interceptor.js
Last active
February 22, 2018 14:47
-
-
Save VivienAdnot/3a042d1912b152d4c98b9d2864852556 to your computer and use it in GitHub Desktop.
Axios 401 response interceptor.
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
// Add a 401 response interceptor | |
window.axios.interceptors.response.use(function (response) { | |
return response; | |
}, function (error) { | |
if (401 === error.response.status) { | |
window.location = '/login'; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment