mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-02-03 02:54:40 +08:00
fix(Login): avoid infinite loop when query redirect to next route redirect (#3630). resolve #3620 #3627
This commit is contained in:
parent
1a7ae0e810
commit
ab55cbf99b
@ -113,6 +113,11 @@ export function createPermissionGuard(router: Router) {
|
||||
} else if (from.query.redirect) {
|
||||
// 存在redirect
|
||||
const redirect = decodeURIComponent((from.query.redirect as string) || '');
|
||||
|
||||
// 只处理一次 from.query.redirect
|
||||
// 也避免某场景(指向路由定义了 redirect)下的死循环
|
||||
from.query.redirect = '';
|
||||
|
||||
if (redirect === to.fullPath) {
|
||||
// 已经被redirect
|
||||
next();
|
||||
@ -120,6 +125,7 @@ export function createPermissionGuard(router: Router) {
|
||||
// 指向redirect
|
||||
next({ path: redirect, replace: true });
|
||||
}
|
||||
next();
|
||||
} else {
|
||||
// 正常访问
|
||||
next();
|
||||
|
Loading…
Reference in New Issue
Block a user