v0 में फ़ॉर्म
Server Actions और Resend न लगाएँ। Formgong पर fetch काफी है।
- प्रॉम्प्ट से सेक्शन बनाएँ।
- Accept और Content-Type जाँचें।
- सफलता JSON का success फ़ील्ड है।
- कुंजी फ़्रंटएंड में रहने दें।
Prompt
संपर्क सेक्शन जोड़ो। Server Actions या Resend मत लगाओ। Formgong: POST https://formgong.com/submit, access_key fk_your_access_key। फ़ील्ड name, email, message और honeypot botcheck। fetch में Content-Type application/json और Accept: application/json। सफलता: result.success। फ़ाइल नहीं।
fetch
async function onSubmit(event) {
event.preventDefault();
const fields = Object.fromEntries(new FormData(event.currentTarget));
const response = await fetch("https://formgong.com/submit", {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({ ...fields, access_key: "fk_your_access_key" }),
});
const result = await response.json();
if (!result.success) throw new Error(result.message || "Formgong error");
}