Fixed contact form on main page
Sends data to mail Secrets from self-hosted infisical
This commit is contained in:
@ -46,10 +46,21 @@ export function ContactForm({ currentLocale }) {
|
||||
},
|
||||
});
|
||||
|
||||
function onSubmit(values: z.infer<typeof formSchema>) {
|
||||
// Do something with the form values.
|
||||
// ✅ This will be type-safe and validated.
|
||||
console.log(values);
|
||||
async function onSubmit(values: z.infer<typeof formSchema>) {
|
||||
const formData = new FormData();
|
||||
|
||||
for (const value of Object.keys(values)) {
|
||||
formData.append(value, values[value])
|
||||
}
|
||||
console.log(formData)
|
||||
|
||||
const response = await fetch("/api", {
|
||||
method: "POST",
|
||||
body: formData
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
console.log(data.message)
|
||||
}
|
||||
|
||||
return (
|
||||
@ -64,7 +75,7 @@ export function ContactForm({ currentLocale }) {
|
||||
</DialogTrigger>
|
||||
<DialogContent className="sm:max-w-[425px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle><h1 className="text-foreground">{t("contact").title}</h1></DialogTitle>
|
||||
<DialogTitle><p className="text-foreground">{t("contact").title}</p></DialogTitle>
|
||||
<DialogDescription>{t("contact").description}</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
|
Reference in New Issue
Block a user