This commit is contained in:
chiayin
2023-10-16 18:38:20 +08:00
parent e751aed3eb
commit 946fabfa93
6 changed files with 68 additions and 204 deletions

View File

@@ -82,10 +82,6 @@ router.beforeEach((to, from) => {
// from: Route: 當前導航正要離開的路由
let isCookie = document.cookie.split(';').some(c => c.trim().startsWith('luciaToken=')); // 是否登入
// 需要驗證登入的頁面,判斷有無登入,無登入要轉址 login
if(to.meta.requiresAuth) {
if (!isCookie) router.push({ name: 'Login' });
}
// 當路由到 login 時有登入要跳轉至home
if (to.name === 'Login') {
if (isCookie) router.push({ name: 'Files' });