v0'da form

Server Actions ve Resend kullanmayın. Formgong'a fetch yeter.

  1. Bölümü aşağıdaki promptla üretin.
  2. Accept ve Content-Type başlıklarını kontrol edin.
  3. Başarı JSON success alanıdır.
  4. Anahtarı frontend'de bırakın.

Prompt

İletişim bölümü ekle. Server Actions veya Resend kullanma.

Formgong: POST https://formgong.com/submit, access_key fk_your_access_key.
Alanlar: name, email, message, gizli botcheck.
fetch: Content-Type application/json ve Accept: application/json.
Başarı: result.success. Dosya yok.

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");
}

Anahtar al