This commit is contained in:
7
app/middleware/auth.ts
Normal file
7
app/middleware/auth.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export default defineNuxtRouteMiddleware((to) => {
|
||||
const { status } = useAuth()
|
||||
|
||||
if (status.value === 'unauthenticated' && to.path !== '/login') {
|
||||
return navigateTo('/login')
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user