diff --git a/web/src/components/misc/Turnstile.svelte b/web/src/components/misc/Turnstile.svelte index d4d872e8..29914995 100644 --- a/web/src/components/misc/Turnstile.svelte +++ b/web/src/components/misc/Turnstile.svelte @@ -2,7 +2,7 @@ import env from "$lib/env"; import { onMount } from "svelte"; - import { turnstileLoaded } from "$lib/state/turnstile"; + import { turnstileLoaded, turnstileCreated } from "$lib/state/turnstile"; let turnstileElement: HTMLElement; let turnstileScript: HTMLElement; @@ -10,6 +10,9 @@ onMount(() => { const sitekey = env.TURNSTILE_KEY; if (!sitekey) return; + + $turnstileCreated = true; + const setup = () => { window.turnstile?.render(turnstileElement, { sitekey, diff --git a/web/src/lib/state/turnstile.ts b/web/src/lib/state/turnstile.ts index 02d32b15..5a165bc7 100644 --- a/web/src/lib/state/turnstile.ts +++ b/web/src/lib/state/turnstile.ts @@ -1,3 +1,4 @@ import { writable } from "svelte/store"; export const turnstileLoaded = writable(false); +export const turnstileCreated = writable(false); diff --git a/web/src/routes/+layout.svelte b/web/src/routes/+layout.svelte index 645ee57c..908a5e15 100644 --- a/web/src/routes/+layout.svelte +++ b/web/src/routes/+layout.svelte @@ -1,18 +1,21 @@