From 943310bb423e1116ccc74be4a35b05592f6be3bd Mon Sep 17 00:00:00 2001 From: LIlGG <1103069291@qq.com> Date: Wed, 27 Mar 2024 18:36:56 +0800 Subject: [PATCH 1/2] fix: wrong router navigation when redirect to /uc --- ui/console-src/router/guards/auth-check.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/console-src/router/guards/auth-check.ts b/ui/console-src/router/guards/auth-check.ts index 12950f3070..782b1eaee9 100644 --- a/ui/console-src/router/guards/auth-check.ts +++ b/ui/console-src/router/guards/auth-check.ts @@ -2,7 +2,7 @@ import { rbacAnnotations } from "@/constants/annotations"; import { useUserStore } from "@/stores/user"; import type { Router } from "vue-router"; -const whiteList = ["Setup", "Login", "Binding", "ResetPassword"]; +const whiteList = ["Setup", "Login", "Binding", "ResetPassword", "Redirect"]; export function setupAuthCheckGuard(router: Router) { router.beforeEach((to, from, next) => { @@ -52,7 +52,7 @@ export function setupAuthCheckGuard(router: Router) { return; } - if (to.name === "whiteList") { + if (whiteList.includes(to.name)) { next(); return; } From 18d2e4cb066f2cca53acb268a90ba28a7720b3b2 Mon Sep 17 00:00:00 2001 From: Li Date: Wed, 27 Mar 2024 19:31:38 +0800 Subject: [PATCH 2/2] update type check --- ui/console-src/router/guards/auth-check.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/console-src/router/guards/auth-check.ts b/ui/console-src/router/guards/auth-check.ts index 782b1eaee9..203ae12f19 100644 --- a/ui/console-src/router/guards/auth-check.ts +++ b/ui/console-src/router/guards/auth-check.ts @@ -52,7 +52,7 @@ export function setupAuthCheckGuard(router: Router) { return; } - if (whiteList.includes(to.name)) { + if (to.name && whiteList.includes(to.name as string)) { next(); return; }