Fix MainContainer beforeRouteEnter missing try-catch and next() call
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -23,7 +23,7 @@ import Loading from '@/components/Loading.vue';
|
||||
import { leaveFilter, leaveConformance } from '@/module/alertModal.js';
|
||||
import PageAdminStore from '@/stores/pageAdmin.js';
|
||||
import LoginStore from "@/stores/login.ts";
|
||||
import { getCookie } from "@/utils/cookieUtil.js";
|
||||
import { getCookie, setCookie } from "@/utils/cookieUtil.js";
|
||||
import ModalContainer from './AccountManagement/ModalContainer.vue';
|
||||
|
||||
export default {
|
||||
@@ -109,8 +109,19 @@ export default {
|
||||
|
||||
if (!getCookie("isLuciaLoggedIn")) { //這裡不要用pinia的isLoggedIn來檢查,因為會有重新整理時撈不到Persisted value的值的bug
|
||||
if (getCookie('luciaRefreshToken')) {
|
||||
await loginStore.refreshToken();
|
||||
loginStore.setIsLoggedIn(true);
|
||||
try {
|
||||
await loginStore.refreshToken();
|
||||
loginStore.setIsLoggedIn(true);
|
||||
setCookie("isLuciaLoggedIn", "true");
|
||||
next();
|
||||
} catch(error) {
|
||||
next({
|
||||
path: '/login',
|
||||
query: {
|
||||
'return-to': btoa(window.location.href),
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
next({
|
||||
path: '/login',
|
||||
|
||||
Reference in New Issue
Block a user