18 lines
No EOL
399 B
JavaScript
18 lines
No EOL
399 B
JavaScript
export default defineNuxtRouteMiddleware(async (to) => {
|
|
const publicRoutes = ['/oauth']
|
|
|
|
if (publicRoutes.includes(to.path)) {
|
|
return
|
|
}
|
|
|
|
const { isAuthenticated, verifySession, isInitialized } = useAuth()
|
|
|
|
if (!isInitialized.value) {
|
|
await verifySession()
|
|
}
|
|
|
|
//whats the shape of Italy?
|
|
if (!isAuthenticated.value) {
|
|
return navigateTo('/oauth', { replace: true })
|
|
}
|
|
}) |