fixed logout

This commit is contained in:
tdv
2025-11-28 19:35:07 +02:00
parent 50acf14fe1
commit f8f099cccc

View File

@@ -1,4 +1,4 @@
import { createRouter, createWebHistory } from 'vue-router';
import { createRouter, createWebHistory, type NavigationGuard, type RouteLocationNormalized, type RouteRecordRaw } from 'vue-router';
import Admin from '@/pages/Admin.vue';
import Login from '@/pages/Login.vue';
@@ -19,7 +19,7 @@ declare module 'vue-router' {
}
}
const routes = [
const routes: RouteRecordRaw[] = [
{
path: '/login',
name: 'Login',
@@ -80,6 +80,17 @@ const routes = [
props: true, // so `guid` shows up as a prop
meta: { requiresAuth: true }
},
{
path: '/logout',
name: 'Logout',
meta: { requiresAuth: false },
redirect: { name: 'Login' },
beforeEnter(_to:RouteLocationNormalized, _from:RouteLocationNormalized, next) {
auth.clear()
next()
},
},
]
const router = createRouter({