Formularz w v0

Pomiń Server Actions i Resend. Wystarczy fetch do Formgong.

  1. Wygeneruj sekcję promptem.
  2. Sprawdź nagłówki Accept i Content-Type.
  3. Sukces to pole success.
  4. Klucz zostaw we froncie.

Prompt

Dodaj sekcję kontaktową. Nie używaj Server Actions ani Resend.

Formgong: POST https://formgong.com/submit, access_key fk_your_access_key.
Pola name, email, message, ukryte botcheck.
fetch z Content-Type application/json i Accept: application/json.
Sukces: result.success. Bez plików.

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

Pobierz klucz