add login with sessian and cleanup
All checks were successful
Build and Push Docker Images / build (push) Successful in 2m34s

This commit is contained in:
Rene Kievits
2025-10-22 02:07:56 +02:00
parent 673d29b05f
commit 1980e14e88
31 changed files with 830 additions and 68 deletions

View File

@@ -8,6 +8,7 @@
import { createRouter, createWebHistory } from 'vue-router'
import { setupLayouts } from 'virtual:generated-layouts'
import { routes } from 'vue-router/auto-routes'
import { useAuthStore } from '../stores/auth.ts'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
@@ -33,4 +34,19 @@ router.isReady().then(() => {
localStorage.removeItem('vuetify:dynamic-reload')
})
router.beforeEach(async (to) => {
const auth = useAuthStore()
if (!auth.user && !auth.loading) {
await auth.fetchUser()
}
if (to.path === '/login') return true
if (!auth.isAuthenticated) {
return { path: '/login' }
}
return true
})
export default router