updated authen

This commit is contained in:
Warunee Tamkoo 2024-07-25 11:40:47 +07:00
parent 9ec6a7696a
commit c1f0ac7939
5 changed files with 39 additions and 28 deletions

View file

@ -82,8 +82,11 @@ const router = createRouter({
// authen with keycloak client
router.beforeEach((to, from, next) => {
// console.log('keycloak==>', keycloak)
console.log('keycloak==>', keycloak.authenticated)
if (to.meta.Auth) {
if (keycloak.authenticated === undefined && to.meta.Auth) {
if (keycloak.authenticated === false && to.meta.Auth) {
window.location.href = '/login'
}
} else {