From 08ba241b0e1bbc0030f42604e4e7158a16e0b208 Mon Sep 17 00:00:00 2001 From: eonurk Date: Mon, 29 Jul 2024 19:25:11 +0200 Subject: [PATCH] fix bug contact error --- src/components/ContactForm.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/ContactForm.tsx b/src/components/ContactForm.tsx index 169b2c3..b31fc27 100644 --- a/src/components/ContactForm.tsx +++ b/src/components/ContactForm.tsx @@ -44,6 +44,7 @@ export function ContactFormDemo() { try { const response = await fetch( "https://script.google.com/macros/s/AKfycbxUVRtZlOusMMHw-B076NRY0mapwcWGwgKP_naDoVlEYc_NC2TO6mNEKdYtvNNHNPSwcg/exec", + { method: "POST", headers: { @@ -54,9 +55,8 @@ export function ContactFormDemo() { ); const result = await response.json(); - console.log("HERE:"); - console.log(result); - if (result.result === "success") { + + if (result.ok === "success") { toast({ title: "Success!", description: "Your message has been sent.", @@ -73,7 +73,9 @@ export function ContactFormDemo() { toast({ title: "Error!", variant: "destructive", - description: `There was a problem submitting your form: ${error.message}`, + description: `There was a problem submitting your form: ${ + (error as Error).message + }`, }); } }