From e4a911f270f1a7686f7ca541ff78dc4cdac0cfa6 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Mon, 28 Oct 2024 10:35:54 +0700 Subject: [PATCH] VITE_URL_SSO --- .env | 3 ++- .env.production | 3 ++- entrypoint.sh | 1 + src/plugins/auth.ts | 6 ++++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.env b/.env index 56270fe5..dce5f3a1 100644 --- a/.env +++ b/.env @@ -1 +1,2 @@ -VITE_API_URI_CONFIG: "https://bma-ehr.frappet.synology.me/api/v1" \ No newline at end of file +VITE_API_URI_CONFIG: "https://bma-ehr.frappet.synology.me/api/v1" +VITE_URL_SSO: "https://bma-sso.frappet.synology.me" \ No newline at end of file diff --git a/.env.production b/.env.production index c3e31e15..2af45fc8 100644 --- a/.env.production +++ b/.env.production @@ -5,4 +5,5 @@ VITE_API_PUBLISH_URL=VITE_API_PUBLISH_URL VITE_API_REPORT_URL=VITE_API_REPORT_URL VITE_API_URI_CONFIG=VITE_API_URI_CONFIG VITE_CLIENTSECRET_KEYCLOAK=VITE_CLIENTSECRET_KEYCLOAK -VITE_MANUAL_URL=VITE_MANUAL_URL \ No newline at end of file +VITE_MANUAL_URL=VITE_MANUAL_URL +VITE_URL_SSO: VITE_URL_SSO \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 4372c3c0..f71b0009 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -16,6 +16,7 @@ do sed -i 's|VITE_API_URI_CONFIG|'${VITE_API_URI_CONFIG}'|g' $file sed -i 's|VITE_CLIENTSECRET_KEYCLOAK|'${VITE_CLIENTSECRET_KEYCLOAK}'|g' $file sed -i 's|VITE_MANUAL_URL|'${VITE_MANUAL_URL}'|g' $file + sed -i 's|VITE_URL_SSO|'${VITE_URL_SSO}'|g' $file done diff --git a/src/plugins/auth.ts b/src/plugins/auth.ts index 922a7fb3..d8f0e94f 100644 --- a/src/plugins/auth.ts +++ b/src/plugins/auth.ts @@ -1,5 +1,7 @@ const ACCESS_TOKEN = "BMAHRISADM_KEYCLOAK_IDENTITY"; - +const key_C_Config = { + url_Logout: import.meta.env.VITE_URL_SSO, +}; interface AuthResponse { access_token: string; expires_in: number; @@ -15,7 +17,7 @@ async function setAuthen(r: AuthResponse) { async function logout() { await deleteCookie(ACCESS_TOKEN); - window.location.href = "/login"; + window.location.href = key_C_Config.url_Logout; } async function getToken() {