diff --git a/app/middleware/auth.global.js b/app/middleware/auth.global.js new file mode 100644 index 0000000..0df7250 --- /dev/null +++ b/app/middleware/auth.global.js @@ -0,0 +1,18 @@ +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 }) + } +}) \ No newline at end of file diff --git a/app/pages/[...slug].vue b/app/pages/[...slug].vue new file mode 100644 index 0000000..b1f06a6 --- /dev/null +++ b/app/pages/[...slug].vue @@ -0,0 +1,20 @@ + + + \ No newline at end of file diff --git a/app/pages/welcome/index.vue b/app/pages/welcome/index.vue index d5faea3..43b31e7 100644 --- a/app/pages/welcome/index.vue +++ b/app/pages/welcome/index.vue @@ -1,7 +1,7 @@