docs(permission.ts): 注释完善

This commit is contained in:
郝先瑞
2022-03-22 00:00:02 +08:00
parent bf9fa6e46b
commit 0d09c9f609

View File

@@ -6,7 +6,7 @@ import 'nprogress/nprogress.css'
NProgress.configure({ showSpinner: false }) // 进度环显示/隐藏 NProgress.configure({ showSpinner: false }) // 进度环显示/隐藏
// 白名单 // 白名单路由
const whiteList = ['/login', '/auth-redirect'] const whiteList = ['/login', '/auth-redirect']
router.beforeEach(async (to, form, next) => { router.beforeEach(async (to, form, next) => {
@@ -32,7 +32,7 @@ router.beforeEach(async (to, form, next) => {
}) })
next({ ...to, replace: true }) next({ ...to, replace: true })
} catch (error) { } catch (error) {
// remove token and go to login page to re-login // 移除 token 并跳转登录页
await user.resetToken() await user.resetToken()
ElMessage.error(error as any || 'Has Error') ElMessage.error(error as any || 'Has Error')
next(`/login?redirect=${to.path}`) next(`/login?redirect=${to.path}`)
@@ -41,7 +41,7 @@ router.beforeEach(async (to, form, next) => {
} }
} }
} else { } else {
// 无 token // 未登录可以访问白名单页面(登录页面)
if (whiteList.indexOf(to.path) !== -1) { if (whiteList.indexOf(to.path) !== -1) {
next() next()
} else { } else {