טופס ב-v0

בלי Server Actions ובלי Resend. fetch אל Formgong מספיק.

  1. צרו את המקטע עם הפרומפט.
  2. בדקו את Accept ואת Content-Type.
  3. הצלחה היא השדה success.
  4. השאירו את המפתח בפרונטאנד.

Prompt

הוסף מקטע יצירת קשר. אל תשתמש ב-Server Actions או ב-Resend.

Formgong: POST https://formgong.com/submit, access_key fk_your_access_key.
שדות name, email, message ומלכודת 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");
}

מפתח גישה