From c9411336eae616e1d4ac688940fe7561f5d7ea47 Mon Sep 17 00:00:00 2001 From: ajaynegi45 Date: Mon, 9 Dec 2024 01:55:55 +0530 Subject: [PATCH] Add contact form --- src/app/contactform/page.tsx | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/app/contactform/page.tsx b/src/app/contactform/page.tsx index 7c65b03..17eb88b 100644 --- a/src/app/contactform/page.tsx +++ b/src/app/contactform/page.tsx @@ -26,25 +26,28 @@ export default function ContactForm() { }; const handleSubmit = async (e: FormEvent) => { - e.preventDefault(); + // e.preventDefault(); + // + // try { + // const res = await fetch('/api/contact', { + // method: 'POST', + // headers: { 'Content-Type': 'application/json' }, + // body: JSON.stringify(formData), + // }); + // + // if (res.ok) { + // toast.success("Thank you for contacting us! Your message has been sent."); + // setFormData({ name: '', email: '', reason: '', message: '' }); + // } else { + // toast.error("There was a problem sending the message. Please try again"); + // } + // } catch (error) { + // toast.error("An unexpected error occurred. Please try again."); + // } - try { - const res = await fetch('/api/contact', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(formData), - }); - if (res.ok) { - toast.success("Thank you for contacting us! Your message has been sent."); - setFormData({ name: '', email: '', reason: '', message: '' }); - } else { - toast.error("There was a problem sending the message. Please try again"); - } - } catch (error) { - toast.error("An unexpected error occurred. Please try again."); - } }; + toast.info("Currently Working on this form!"); return (