From f4592d28445a7ee3296b28129377e22f7a6f692c Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Fri, 26 Jul 2024 10:07:47 +0700 Subject: [PATCH] fixing check token --- src/main.ts | 3 --- src/router/index.ts | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index 24545e6ac..d42cd5ead 100644 --- a/src/main.ts +++ b/src/main.ts @@ -104,7 +104,6 @@ if (kcToken && kcRefreshToken) { token: kcToken, refreshToken: kcRefreshToken, }); - keycloak.authenticated = true; // .then((authenticated) => { // console.log("authenticated", authenticated); @@ -117,8 +116,6 @@ if (kcToken && kcRefreshToken) { // .catch((err) => { // console.error("Keycloak initialization failed:", err); // }); -} else { - keycloak.authenticated = false; } app.mount("#app"); diff --git a/src/router/index.ts b/src/router/index.ts index 79747b623..a3e912901 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -108,7 +108,7 @@ const router = createRouter({ // authen with keycloak client router.beforeEach((to, from, next) => { if (to.meta.Auth) { - if (keycloak.authenticated === false && to.meta.Auth) { + if (keycloak.authenticated === undefined && to.meta.Auth) { window.location.href = "/login"; } } else {