Files
webapp/app/middleware/auth-oidc.ts
2026-04-21 11:16:27 +07:00

20 lines
451 B
TypeScript

export default defineNuxtRouteMiddleware(async (to) => {
const basePath = stripLocalePrefix(to.path, ['ru', 'en'])
// Skip auth routes handled by @logto/nuxt
if (basePath === '/sign-in' || basePath === '/sign-out' || basePath === '/callback') {
return
}
// Skip public auth paths
if (basePath.startsWith('/auth/')) {
return
}
const { loggedIn } = useAuth()
if (!loggedIn.value) {
return navigateTo('/sign-in')
}
})