forked from verdnatura/salix-front
Merge pull request '5608-fixRedirectWhenIsUnauthorized' (!63) from 5608-fixRedirectWhenIsUnauthorized into dev
Reviewed-on: verdnatura/salix-front#63 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
bb4bf0e6db
|
@ -60,9 +60,10 @@ const onResponseError = (error) => {
|
||||||
|
|
||||||
if (session.isLoggedIn() && response.status === 401) {
|
if (session.isLoggedIn() && response.status === 401) {
|
||||||
session.destroy();
|
session.destroy();
|
||||||
Router.push({ path: '/login' });
|
const hash = window.location.hash;
|
||||||
} else if(!session.isLoggedIn())
|
const url = hash.slice(1);
|
||||||
{
|
Router.push({ path: url });
|
||||||
|
} else if (!session.isLoggedIn()) {
|
||||||
message = 'login.loginError';
|
message = 'login.loginError';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +78,4 @@ const onResponseError = (error) => {
|
||||||
axios.interceptors.request.use(onRequest, onRequestError);
|
axios.interceptors.request.use(onRequest, onRequestError);
|
||||||
axios.interceptors.response.use(onResponse, onResponseError);
|
axios.interceptors.response.use(onResponse, onResponseError);
|
||||||
|
|
||||||
export {
|
export { onRequest, onResponseError };
|
||||||
onRequest,
|
|
||||||
onResponseError
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue