نموذج في v0

لا تستخدم Server Actions ولا Resend. يكفي fetch إلى Formgong.

  1. ولّد القسم بالموجّه أدناه.
  2. راجع ترويستي Accept و Content-Type.
  3. النجاح هو الحقل success.
  4. اترك المفتاح في الواجهة.

Prompt

أضف قسماً للتواصل. لا تستخدم Server Actions ولا Resend.

Formgong: POST https://formgong.com/submit والمفتاح 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");
}

مفتاح وصول