From 7b72d7a565ba6bbaa44ebb075b68646fed5206d0 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 8 Aug 2025 22:10:08 +0200 Subject: [PATCH] fixed auth --- plugins/01.auth-check.client.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/01.auth-check.client.ts b/plugins/01.auth-check.client.ts index 99caf0c..b259d6d 100644 --- a/plugins/01.auth-check.client.ts +++ b/plugins/01.auth-check.client.ts @@ -1,6 +1,14 @@ export default defineNuxtPlugin(async () => { - const { checkAuth } = useAuth(); + const router = useRouter(); + const route = useRoute(); - // Check authentication status on app startup - await checkAuth(); + // Skip auth check on public pages + const publicPages = ['/login', '/signup', '/auth/callback', '/forgot-password']; + const isPublicPage = publicPages.some(page => route.path.startsWith(page)); + + if (!isPublicPage) { + const { checkAuth } = useAuth(); + // Check authentication status on app startup for non-public pages + await checkAuth(); + } });