Skip to content

Instantly share code, notes, and snippets.

View VivienAdnot's full-sized avatar

Vivien Adnot VivienAdnot

View GitHub Profile
@VivienAdnot
VivienAdnot / axios-401-response-interceptor.js
Last active February 22, 2018 14:47 — forked from yajra/axios-401-response-interceptor.js
Axios 401 response interceptor.
// Add a 401 response interceptor
window.axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
if (401 === error.response.status) {
window.location = '/login';
}
});