feat: initial logins

This commit is contained in:
2025-06-12 13:58:59 +01:00
parent b516196d38
commit 3bdee89eed
12 changed files with 716 additions and 444 deletions

View File

@@ -2,14 +2,22 @@
import posthog from "posthog-js";
import logoUrl from "$lib/assets/logo.svg";
import { onMount } from "svelte";
import { invalidate } from "$app/navigation";
const { children } = $props();
let { data, children } = $props();
let { session, supabase } = $derived(data);
onMount(() => {
posthog.init("phc_hTnel2Q8GKo0TgIBnFWBueJW1ATmCG9tJOtETnQTUdY", {
api_host: "https://eu.i.posthog.com",
person_profiles: "always"
});
const { data } = supabase.auth.onAuthStateChange((_, newSession) => {
if (newSession?.expires_at !== session?.expires_at) {
invalidate("supabase:auth");
}
});
return () => data.subscription.unsubscribe();
});
</script>