finish srs system

This commit is contained in:
Rene Kievits
2025-10-27 05:45:38 +01:00
parent 882328c28e
commit 150667f781
19 changed files with 652 additions and 1011 deletions

View File

@@ -34,19 +34,24 @@ router.isReady().then(() => {
localStorage.removeItem('vuetify:dynamic-reload')
})
let hasFetchedUser = false
router.beforeEach(async (to) => {
const auth = useAuthStore()
if (!auth.user && !auth.loading) {
await auth.fetchUser()
}
if (to.path === '/login') return true
if (!hasFetchedUser && !auth.user && !auth.loading) {
hasFetchedUser = true
await auth.fetchUser()
}
if (!auth.isAuthenticated) {
return { path: '/login' }
return { path: '/login', query: { redirect: to.fullPath } }
}
return true
})
export default router