From e31132cddc40bb4e469e72dcd8c72d4f2e0947b4 Mon Sep 17 00:00:00 2001 From: Keith Date: Mon, 23 Nov 2026 16:58:57 +0100 Subject: [PATCH] fix leadform to avoid cors issue --- src/components/LeadForm.astro | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/LeadForm.astro b/src/components/LeadForm.astro index e41b9b4..a944fcb 100644 --- a/src/components/LeadForm.astro +++ b/src/components/LeadForm.astro @@ -149,14 +149,13 @@ const note = type === "founders" ? strings.form_founders_note : strings.form_hub button.disabled = true; button.textContent = STRINGS.sending || "Sending…"; try { - const res = await fetch(form.dataset.webhook, { + await fetch(form.dataset.webhook, { method: "POST", - headers: { "Content-Type": "application/json" }, + mode: "no-cors", // tell the browser we don't need to read the response + headers: { "Content-Type": "text/plain;charset=UTF-8" }, // no preflight triggered body: JSON.stringify(payload), }); - if (!res.ok) throw new Error("HTTP " + res.status); - form.innerHTML = - '

'; + form.innerHTML = '

'; form.querySelector(".lead-ok").textContent = form.dataset.i18nSuccess; } catch { const p = document.createElement("p");