双token(未做完)

This commit is contained in:
caozehui
2025-02-07 10:39:30 +08:00
parent c16560a0ca
commit 6065fd1f67
8 changed files with 29 additions and 14 deletions

View File

@@ -52,7 +52,7 @@ router.beforeEach(async (to, from, next) => {
// 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页
if (to.path.toLocaleLowerCase() === LOGIN_URL) {
if (userStore.token) return next(from.fullPath)
if (userStore.accessToken) return next(from.fullPath)
resetRouter()
return next()
}
@@ -61,7 +61,7 @@ router.beforeEach(async (to, from, next) => {
if (ROUTER_WHITE_LIST.includes(to.path)) return next()
// 5.判断是否有 Token没有重定向到 login 页面
if (!userStore.token) return next({ path: LOGIN_URL, replace: true })
if (!userStore.accessToken) return next({ path: LOGIN_URL, replace: true })
// 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由
if (!authStore.authMenuListGet.length) {