feat(#14): Update code to match documentation

This commit is contained in:
Josh Creek
2024-07-04 19:27:52 +01:00
parent e15565bb56
commit 113268614b
6 changed files with 42 additions and 38 deletions
+2 -2
View File
@@ -32,8 +32,8 @@
let cookiesAccepted = false;
onMount(() => {
const { data } = supabase.auth.onAuthStateChange((event, _session) => {
if (_session?.expires_at !== session?.expires_at) {
const { data } = supabase.auth.onAuthStateChange((event, newSession) => {
if (newSession?.expires_at !== session?.expires_at) {
// tells SvelteKit that the root +layout.ts load function should be executed whenever the session updates to keep the page store in sync.
invalidate('supabase:auth');
}