From f8f099cccc9eb88b418466df8d77b241b6438e7c Mon Sep 17 00:00:00 2001 From: tdv Date: Fri, 28 Nov 2025 19:35:07 +0200 Subject: [PATCH] fixed logout --- management-ui/src/router.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/management-ui/src/router.ts b/management-ui/src/router.ts index ace207f..143e6e6 100644 --- a/management-ui/src/router.ts +++ b/management-ui/src/router.ts @@ -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({