From d27633fb31824e92cbeb24f8d626d8e33ce7179e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=A0=E6=9C=A8?= Date: Thu, 26 Aug 2021 20:50:25 +0800 Subject: [PATCH] fix: fixed build warning for style of `intro.js` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复intro.js的样式文件造成的build警告 fixed: #1130 --- src/router/guard/permissionGuard.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/router/guard/permissionGuard.ts b/src/router/guard/permissionGuard.ts index 09027b82d27..4d394142788 100644 --- a/src/router/guard/permissionGuard.ts +++ b/src/router/guard/permissionGuard.ts @@ -29,14 +29,24 @@ export function createPermissionGuard(router: Router) { return; } + const token = userStore.getToken; + // Whitelist can be directly entered if (whitePathList.includes(to.path as PageEnum)) { + if (to.path === LOGIN_PATH && token) { + const isSessionTimeout = userStore.getSessionTimeout; + try { + await userStore.afterLoginAction(); + if (!isSessionTimeout) { + next((to.query?.redirect as string) || '/'); + return; + } + } catch {} + } next(); return; } - const token = userStore.getToken; - // token does not exist if (!token) { // You can access without permission. You need to set the routing meta.ignoreAuth to true