From 7ef16a69f291b65e76e378592c7d360031fbc2e6 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 15 Jun 2023 11:37:54 +0200 Subject: [PATCH 1/2] refs #5608 fix: redirect cuando dice 'Authorization Required' --- src/boot/axios.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/boot/axios.js b/src/boot/axios.js index cbd5e7213..64a6dac5f 100644 --- a/src/boot/axios.js +++ b/src/boot/axios.js @@ -1,7 +1,7 @@ import axios from 'axios'; import { Notify } from 'quasar'; import { useSession } from 'src/composables/useSession'; -import { Router } from 'src/router'; +// import { Router } from 'src/router'; import { i18n } from './i18n'; const session = useSession(); @@ -60,9 +60,11 @@ const onResponseError = (error) => { if (session.isLoggedIn() && response.status === 401) { session.destroy(); - Router.push({ path: '/login' }); - } else if(!session.isLoggedIn()) - { + const hash = window.location.hash; + const url = hash.slice(1); + window.location.href = url; + // Router.push({ path: url }); + } else if (!session.isLoggedIn()) { message = 'login.loginError'; } @@ -77,7 +79,4 @@ const onResponseError = (error) => { axios.interceptors.request.use(onRequest, onRequestError); axios.interceptors.response.use(onResponse, onResponseError); -export { - onRequest, - onResponseError -} +export { onRequest, onResponseError }; From 1895e4ff980ad69fa2528ccf94288de1205615c6 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 15 Jun 2023 11:46:15 +0200 Subject: [PATCH 2/2] refs #5608 fix: use Router --- src/boot/axios.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/boot/axios.js b/src/boot/axios.js index 64a6dac5f..f8f27278c 100644 --- a/src/boot/axios.js +++ b/src/boot/axios.js @@ -1,7 +1,7 @@ import axios from 'axios'; import { Notify } from 'quasar'; import { useSession } from 'src/composables/useSession'; -// import { Router } from 'src/router'; +import { Router } from 'src/router'; import { i18n } from './i18n'; const session = useSession(); @@ -62,8 +62,7 @@ const onResponseError = (error) => { session.destroy(); const hash = window.location.hash; const url = hash.slice(1); - window.location.href = url; - // Router.push({ path: url }); + Router.push({ path: url }); } else if (!session.isLoggedIn()) { message = 'login.loginError'; }