Handle unauthenticated responses

parent 4e6d38c1
...@@ -31311,13 +31311,20 @@ var app = new _vue2.default({ ...@@ -31311,13 +31311,20 @@ var app = new _vue2.default({
}); });
window.axios.interceptors.response.use(null, function (error) { window.axios.interceptors.response.use(null, function (error) {
if (error.response.status === 401) { if (error.response.status === 403) {
app.$notify.error({ app.$notify.error({
title: app.$t('core.unauthorized'), title: app.$t('core.unauthorized'),
message: app.$t('core.unauthorized-access') message: app.$t('core.unauthorized-access')
}); });
window.location = route('dashboard.index'); window.location = route('dashboard.index');
} }
if (error.response.status === 401) {
app.$notify.error({
title: app.$t('core.unauthenticated'),
message: app.$t('core.unauthenticated-message')
});
window.location = route('login');
}
return Promise.reject(error); return Promise.reject(error);
}); });
...@@ -44,12 +44,19 @@ const app = new Vue({ ...@@ -44,12 +44,19 @@ const app = new Vue({
}); });
window.axios.interceptors.response.use(null, function(error) { window.axios.interceptors.response.use(null, function(error) {
if (error.response.status === 401) { if (error.response.status === 403) {
app.$notify.error({ app.$notify.error({
title: app.$t('core.unauthorized'), title: app.$t('core.unauthorized'),
message: app.$t('core.unauthorized-access'), message: app.$t('core.unauthorized-access'),
}); });
window.location = route('dashboard.index') window.location = route('dashboard.index');
}
if (error.response.status === 401) {
app.$notify.error({
title: app.$t('core.unauthenticated'),
message: app.$t('core.unauthenticated-message'),
});
window.location = route('login');
} }
return Promise.reject(error); return Promise.reject(error);
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment