This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch dev-2.1.6
in repository https://gitbox.apache.org/repos/asf/streampark.git
The following commit(s) were added to refs/heads/dev-2.1.6 by this push:
new ef17e4280 [Improve] permissionGuard bug fixed.
ef17e4280 is described below
commit ef17e4280449595aeffb5a134cb0304b57f4339a
Author: benjobs <[email protected]>
AuthorDate: Wed Feb 19 18:43:25 2025 +0800
[Improve] permissionGuard bug fixed.
---
.../src/router/guard/permissionGuard.ts | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git
a/streampark-console/streampark-console-webapp/src/router/guard/permissionGuard.ts
b/streampark-console/streampark-console-webapp/src/router/guard/permissionGuard.ts
index 1ffe0c33c..828a85225 100644
---
a/streampark-console/streampark-console-webapp/src/router/guard/permissionGuard.ts
+++
b/streampark-console/streampark-console-webapp/src/router/guard/permissionGuard.ts
@@ -18,7 +18,12 @@ const whitePathList: PageEnum[] = [LOGIN_PATH];
export function createPermissionGuard(router: Router) {
const userStore = useUserStoreWithOut();
const permissionStore = usePermissionStoreWithOut();
+
router.beforeEach(async (to, from, next) => {
+ const isPageNoFound = [
+ PAGE_NOT_FOUND_ROUTE.name,
+ PAGE_NOT_FOUND_ROUTE.name + '_CHILD',
+ ].includes(to.name as string);
if (
from.path === ROOT_PATH &&
to.path === PageEnum.BASE_HOME &&
@@ -72,7 +77,7 @@ export function createPermissionGuard(router: Router) {
// Jump to the 404 page after processing the login
if (
from.path === LOGIN_PATH &&
- to.name === PAGE_NOT_FOUND_ROUTE.name &&
+ isPageNoFound &&
to.fullPath !== (userStore.getUserInfo.homePath || PageEnum.BASE_HOME)
) {
next(userStore.getUserInfo.homePath || PageEnum.BASE_HOME);
@@ -103,7 +108,7 @@ export function createPermissionGuard(router: Router) {
permissionStore.setDynamicAddedRoute(true);
- if (to.name === PAGE_NOT_FOUND_ROUTE.name) {
+ if (isPageNoFound) {
// After dynamically adding the route, it should be redirected to
fullPath here, otherwise the 404 page content will load
next({ path: to.fullPath, replace: true, query: to.query });
} else {