check cookie redirect sso

This commit is contained in:
Warunee Tamkoo 2024-12-20 22:48:33 +07:00
parent 3806ce6843
commit 28ff743911

View file

@ -4,7 +4,7 @@ import MapView from '@/views/MapView.vue'
import MainView from '@/views/MainView.vue'
const loginView = () => import('@/views/login.vue')
import { authenticated } from '@/plugins/auth'
import { authenticated, logout } from '@/plugins/auth'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
@ -85,7 +85,7 @@ router.beforeEach(async (to, from, next) => {
if (to.meta.Auth) {
const checkAuthen = await authenticated()
if (!checkAuthen && to.meta.Auth) {
router.push({ name: 'loginMain' })
logout()
}
} else {
next()