refs #5608 fix: redirect cuando dice 'Authorization Required'
gitea/salix-front/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2023-06-15 11:37:54 +02:00
parent 5cf7bd95ec
commit 7ef16a69f2
1 changed files with 7 additions and 8 deletions

View File

@ -1,7 +1,7 @@
import axios from 'axios'; import axios from 'axios';
import { Notify } from 'quasar'; import { Notify } from 'quasar';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { Router } from 'src/router'; // import { Router } from 'src/router';
import { i18n } from './i18n'; import { i18n } from './i18n';
const session = useSession(); const session = useSession();
@ -60,9 +60,11 @@ 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);
{ window.location.href = url;
// Router.push({ path: url });
} else if (!session.isLoggedIn()) {
message = 'login.loginError'; message = 'login.loginError';
} }
@ -77,7 +79,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
}