Initial commit from monorepo
This commit is contained in:
17
app/middleware/auth-oidc.ts
Normal file
17
app/middleware/auth-oidc.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export default defineNuxtRouteMiddleware(async (to) => {
|
||||
// Skip auth routes handled by @logto/nuxt
|
||||
if (to.path === '/sign-in' || to.path === '/sign-out' || to.path === '/callback') {
|
||||
return
|
||||
}
|
||||
|
||||
// Skip public auth paths
|
||||
if (to.path.startsWith('/auth/')) {
|
||||
return
|
||||
}
|
||||
|
||||
const { loggedIn } = useAuth()
|
||||
|
||||
if (!loggedIn.value) {
|
||||
return navigateTo('/sign-in')
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user