fixing bug check token

This commit is contained in:
Warunee Tamkoo 2024-07-26 10:02:23 +07:00
parent 177b85a6a9
commit 04da1988b0
2 changed files with 1 additions and 4 deletions

View file

@ -59,7 +59,6 @@ if (kcToken && kcRefreshToken) {
token: kcToken,
refreshToken: kcRefreshToken,
})
keycloak.authenticated = true
// .then((authenticated) => {
// console.log('authenticated', authenticated)
// if (!authenticated) {
@ -71,8 +70,6 @@ if (kcToken && kcRefreshToken) {
// .catch((err) => {
// console.error('Keycloak initialization failed:', err)
// })
} else {
keycloak.authenticated = false
}
app.mount('#app')

View file

@ -86,7 +86,7 @@ router.beforeEach((to, from, next) => {
console.log('keycloak==>', keycloak.authenticated)
if (to.meta.Auth) {
if (keycloak.authenticated === false && to.meta.Auth) {
if (keycloak.authenticated === undefined && to.meta.Auth) {
window.location.href = '/login'
}
} else {