Skip to content

Commit

Permalink
Invalidate auth cache on login
Browse files Browse the repository at this point in the history
  • Loading branch information
craigkai committed Oct 15, 2024
1 parent e8bc19f commit 3d0147e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/routes/auth/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { invalidate } from '$app/navigation';
import { signUpSchema, signInSchema, resetPasswordSchema } from './schemas';
import { setError, message, superValidate, fail } from 'sveltekit-superforms';
import { zod } from 'sveltekit-superforms/adapters';
Expand Down Expand Up @@ -29,6 +30,8 @@ export const actions = {
return setError(form, 'email', error.message);
}

invalidate('supabase:auth');

// Instead of returning the form directly, redirect or trigger a session update
// Option 1: Redirect after signing in
return { form, redirect: '/protected-routes/dashboard' };
Expand Down

0 comments on commit 3d0147e

Please sign in to comment.