From 12ed50d96bce47b01241dff4783667075bc66514 Mon Sep 17 00:00:00 2001 From: Christopher Arraya Date: Fri, 7 Jul 2023 00:53:47 -0400 Subject: [PATCH] can't be empty --- app/page.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/page.tsx b/app/page.tsx index 7b41a0b..4069968 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -15,6 +15,11 @@ export default function Home() { const [submitted, setSubmitted] = useState(false); async function handleSubmit(e: any) { e.preventDefault(); // prevent the default form submission behavior + if (!email) { + setAlertType("error"); + setAlertMessage("Please enter an email."); + return; + } // if the email field is empty, do nothing const res = await fetch("/api/waitlist", { method: "POST", // specify the HTTP method headers: { "Content-Type": "application/json" }, // specify the content type