Skip to content

Commit 76d106e

Browse files
authored
fix: When defaultHomePage is inconsistent with user.homePath, the pa… (#6299)
* fix: When defaultHomePage is inconsistent with user.homePath, the page refresh route jump will be abnormal * fix: When defaultHomePage is inconsistent with user.homePath, the page refresh route jump will be abnormal
1 parent 78c3c9d commit 76d106e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

playground/src/router/guard.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,16 @@ function setupAccessGuard(router: Router) {
105105
accessStore.setAccessMenus(accessibleMenus);
106106
accessStore.setAccessRoutes(accessibleRoutes);
107107
accessStore.setIsAccessChecked(true);
108-
const redirectPath = (from.query.redirect ??
109-
(to.path === preferences.app.defaultHomePath
110-
? userInfo.homePath || preferences.app.defaultHomePath
111-
: to.fullPath)) as string;
112-
108+
let redirectPath: string;
109+
if (from.query.redirect) {
110+
redirectPath = from.query.redirect as string;
111+
} else if (to.path === preferences.app.defaultHomePath) {
112+
redirectPath = preferences.app.defaultHomePath;
113+
} else if (userInfo.homePath && to.path === userInfo.homePath) {
114+
redirectPath = userInfo.homePath;
115+
} else {
116+
redirectPath = to.fullPath;
117+
}
113118
return {
114119
...router.resolve(decodeURIComponent(redirectPath)),
115120
replace: true,

0 commit comments

Comments
 (0)