This commit is contained in:
2026-09-02 20:49:13 +08:00
parent 4ee8ac3ee7
commit a7c36771e4
4 changed files with 41 additions and 22 deletions
+2 -1
View File
@@ -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