From 66a8302e68644969c7360e1f8a6350a0d16b041e Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 23 Jun 2025 10:47:10 +0700 Subject: [PATCH] logoutSSO --- src/plugins/auth.ts | 6 ++++++ src/views/MainLayout.vue | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/auth.ts b/src/plugins/auth.ts index 71bd05c..d9adf60 100644 --- a/src/plugins/auth.ts +++ b/src/plugins/auth.ts @@ -87,6 +87,11 @@ async function redirectToLandingPage() { window.location.href = key_C_Config.landing_PageUrl; } +async function logoutSSO() { + await deleteCookie(ACCESS_TOKEN); + window.location.href = key_C_Config.landing_PageUrl + `/logout`; +} + export { getToken, authenticated, @@ -95,4 +100,5 @@ export { tokenParsed, getCookie, redirectToLandingPage, + logoutSSO, }; diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index c99d63f..534beb3 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -12,6 +12,7 @@ import { logout, getCookie, redirectToLandingPage, + logoutSSO, } from "@/plugins/auth"; import { useDataStore } from "@/stores/data"; @@ -159,7 +160,7 @@ const doLogout = () => { async () => { await http.post(config.API.keycloakLogSSO, { text: "ออกจากระบบ" }); // authen with client - await logout(); + await logoutSSO(); }, "ยืนยันการออกจากระบบ", "ต้องการออกจากระบบใช่หรือไม่"