feta
This commit is contained in:
@@ -4,6 +4,9 @@ import type { LocationQueryRaw, Router } from 'vue-router'
|
||||
import { useUserStore } from '@/store'
|
||||
import { isLogin } from '@/utils/auth'
|
||||
|
||||
// 不需要登录验证的路由名称
|
||||
const whiteList = ['login', 'home']
|
||||
|
||||
export default function setupUserLoginInfoGuard(router: Router) {
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
NProgress.start()
|
||||
@@ -27,7 +30,8 @@ export default function setupUserLoginInfoGuard(router: Router) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (to.name === 'login') {
|
||||
// 在白名单中的路由不需要登录验证
|
||||
if (whiteList.includes(to.name as string)) {
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user