About: add form state and submit handler
cgen-d968aa02edd4418d99c1b110341ea1fc
This commit is contained in:
parent
93faa3667d
commit
1931f081f7
1 changed files with 26 additions and 0 deletions
|
|
@ -69,6 +69,32 @@ export default function About() {
|
|||
{ kpi: "<30d", label: "MVP timelines" },
|
||||
];
|
||||
|
||||
const [name, setName] = useState("");
|
||||
const [email, setEmail] = useState("");
|
||||
const [topic, setTopic] = useState("community");
|
||||
const [message, setMessage] = useState("");
|
||||
const [isSending, setIsSending] = useState(false);
|
||||
|
||||
const submit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!name.trim() || !email.trim() || !message.trim()) {
|
||||
aethexToast.error({ title: "Missing info", description: "Please fill out all fields." });
|
||||
return;
|
||||
}
|
||||
setIsSending(true);
|
||||
try {
|
||||
aethexToast.success({ title: "Thanks!", description: "We’ll follow up about your request." });
|
||||
setName("");
|
||||
setEmail("");
|
||||
setMessage("");
|
||||
setTopic("community");
|
||||
} catch (err: any) {
|
||||
aethexToast.error({ title: "Failed to send", description: err?.message || "Try again." });
|
||||
} finally {
|
||||
setIsSending(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<div className="min-h-screen bg-aethex-gradient py-12">
|
||||
|
|
|
|||
Loading…
Reference in a new issue