5608-fixRedirectWhenIsUnauthorized #63

Merged
vicent merged 2 commits from 5608-fixRedirectWhenIsUnauthorized into dev 2023-06-16 07:20:31 +00:00
1 changed files with 7 additions and 8 deletions
Showing only changes of commit 7ef16a69f2 - Show all commits

View File

@ -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 };