Working
This commit is contained in:
@@ -1,8 +1,19 @@
|
||||
<script lang="ts">
|
||||
import '../app.css';
|
||||
<script>
|
||||
import { invalidate } from '$app/navigation'
|
||||
import { onMount } from 'svelte'
|
||||
|
||||
let { children } = $props();
|
||||
let { data, children } = $props()
|
||||
let { session, supabase } = $derived(data)
|
||||
|
||||
onMount(() => {
|
||||
const { data } = supabase.auth.onAuthStateChange((_, newSession) => {
|
||||
if (newSession?.expires_at !== session?.expires_at) {
|
||||
invalidate('supabase:auth')
|
||||
}
|
||||
})
|
||||
|
||||
return () => data.subscription.unsubscribe()
|
||||
})
|
||||
</script>
|
||||
|
||||
{@render children()}
|
||||
{@render children()}
|
||||
Reference in New Issue
Block a user