From 4df719cbd6c1cc3a00f90f35aa635449e150b261 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Mon, 28 Oct 2024 10:35:36 +0700 Subject: [PATCH] VITE_URL_SSO --- .env | 1 + .env.production | 2 +- entrypoint.sh | 1 + src/plugins/auth.ts | 6 ++++-- 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..0de4755 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +VITE_URL_SSO: "https://bma-sso.frappet.synology.me" \ No newline at end of file diff --git a/.env.production b/.env.production index fee7bea..277058b 100644 --- a/.env.production +++ b/.env.production @@ -5,7 +5,7 @@ VITE_API_URI_CONFIG=VITE_API_URI_CONFIG VITE_API_PUBLISH_URL=VITE_API_PUBLISH_URL VITE_CLIENTSECRET_KEYCLOAK=VITE_CLIENTSECRET_KEYCLOAK VITE_MANUAL_URL=VITE_MANUAL_URL - +VITE_URL_SSO: VITE_URL_SSO # VITE_REALM_KEYCLOAK: "bma-ehr" # VITE_CLIENTID_KEYCLOAK: "bma-ehr-exam-vue3" # VITE_URL_KEYCLOAK: "https://id.frappet.synology.me/" diff --git a/entrypoint.sh b/entrypoint.sh index dc06009..d84bb9b 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -15,6 +15,7 @@ do sed -i 's|VITE_API_PUBLISH_URL|'${VITE_API_PUBLISH_URL}'|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 8a81562..eb54de8 100644 --- a/src/plugins/auth.ts +++ b/src/plugins/auth.ts @@ -1,5 +1,7 @@ const ACCESS_TOKEN = "BMAHRISUSER_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() {