Files
oysqn.app/app/utils/auth.ts
Patrick Toal c789454810 docs: Update architecture for supabase
test: Add tests for auth workflow
2026-04-12 10:14:44 -04:00

15 lines
447 B
TypeScript

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
}