frontend: Login-Redirect for unauth requests

This commit is contained in:
Frank Agerholm 2026-01-25 17:58:04 +01:00
commit c8b6e4757f
No known key found for this signature in database
4 changed files with 62 additions and 27 deletions

View file

@ -1,7 +1,11 @@
export default defineNuxtRouteMiddleware((to) => {
export default defineNuxtRouteMiddleware((to, from) => {
if (import.meta.server) return // SSR ignorieren
// allow login-page
if (to.meta.requiresAuth !== true) {
return
}
const { token, loadToken } = useAuth()
loadToken()