update auth
This commit is contained in:
parent
23afdc4df9
commit
ff3fb68219
12 changed files with 222 additions and 308 deletions
|
|
@ -4,7 +4,7 @@ import MapView from '@/views/MapView.vue'
|
|||
import MainView from '@/views/MainView.vue'
|
||||
const loginView = () => import('@/views/login.vue')
|
||||
|
||||
import keycloak, { kcLogout } from '@/plugins/keycloak'
|
||||
import { authenticated, logout } from '@/plugins/auth'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
|
|
@ -82,12 +82,9 @@ 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) {
|
||||
kcLogout()
|
||||
if (authenticated === undefined && to.meta.Auth) {
|
||||
logout()
|
||||
}
|
||||
} else {
|
||||
next()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue