docs: Update architecture for supabase

test: Add tests for auth workflow
This commit is contained in:
2026-04-12 10:14:44 -04:00
parent 355f3c5dfa
commit c789454810
13 changed files with 900 additions and 14 deletions

14
app/utils/auth.ts Normal file
View File

@@ -0,0 +1,14 @@
export const PUBLIC_ROUTES = ['/', '/login', '/signup', '/auth/callback'] as const
/**
* Pure auth decision logic — no Nuxt/Supabase dependencies.
* Returns the path to redirect to, or null if no redirect is needed.
*/
export function checkAuthRedirect(
userValue: { id: string } | null,
path: string,
): string | null {
if ((PUBLIC_ROUTES as readonly string[]).includes(path)) return null
if (!userValue) return '/'
return null
}