优化
This commit is contained in:
+2
-1
@@ -32,7 +32,8 @@ router.beforeEach(async (to) => {
|
||||
if (to.meta.requiresAuth && !auth.isAuthenticated) {
|
||||
return { name: 'login', query: { redirect: to.fullPath } }
|
||||
}
|
||||
if ((to.name === 'login' || to.name === 'register') && auth.isAuthenticated) {
|
||||
const isImpersonationHandoff = to.name === 'login' && typeof to.query.impersonationOrigin === 'string'
|
||||
if ((to.name === 'login' || to.name === 'register') && auth.isAuthenticated && !isImpersonationHandoff) {
|
||||
return getFirstAccessiblePath(auth.permissionCodes)
|
||||
}
|
||||
const permission = typeof to.meta.permission === 'string' ? to.meta.permission : undefined
|
||||
|
||||
Reference in New Issue
Block a user