From dbf6fe0123a909b3218aa80f7a6aa50c0b84e4ae Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Fri, 20 Dec 2024 22:36:41 +0700 Subject: [PATCH] check cookie redirect to sso --- src/router/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/router/index.ts b/src/router/index.ts index 892c18743..1e7576923 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -27,7 +27,7 @@ import ModuleCommand from "@/modules/18_command/router"; import ModulePositionCondition from "@/modules/19_condition/router"; // TODO: ใช้หรือไม่? -import { authenticated } from "@/plugins/auth"; +import { authenticated, logout } from "@/plugins/auth"; const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), @@ -117,8 +117,10 @@ const router = createRouter({ router.beforeEach(async (to, from, next) => { if (to.meta.Auth) { const checkAuthen = await authenticated(); + console.log("checkAuthen", checkAuthen); + if (!checkAuthen && to.meta.Auth) { - router.push({ name: "loginMain" }); + logout(); } } next();