Starting over

This commit is contained in:
2025-10-01 22:00:32 -04:00
parent 6d0f99507a
commit 793f395795
29 changed files with 0 additions and 1542 deletions

View File

@@ -1,21 +0,0 @@
export default defineNuxtRouteMiddleware(async (to, from) => {
const token = useCookie('auth_token')
if (!token.value && to.path === '/admin') {
// Redirect to login page if not authenticated and trying to access admin
return navigateTo('/login')
}
if (token.value) {
try {
// Verify token with server
await $fetch('/api/auth/verify')
} catch {
// If token is invalid, clear it and redirect to login
token.value = ''
if (to.path === '/admin') {
return navigateTo('/login')
}
}
}
})