mirror of
https://github.com/ArthurDanjou/arthome.git
synced 2026-01-26 17:40:25 +01:00
Add auth
This commit is contained in:
8
app/middleware/auth.ts
Normal file
8
app/middleware/auth.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export default defineNuxtRouteMiddleware(async () => {
|
||||
const { loggedIn } = useUserSession()
|
||||
const authorized = await isAuthorized()
|
||||
|
||||
if (!loggedIn.value || !authorized) {
|
||||
return navigateTo('/')
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user