Formulário no v0

Sem Server Actions nem Resend. Um fetch para o Formgong chega.

  1. Gere a secção com o prompt.
  2. Verifique Accept e Content-Type.
  3. O sucesso é o campo success.
  4. Deixe a chave no frontend.

Prompt

Adiciona uma secção de contacto. Não uses Server Actions nem Resend.

Formgong: POST https://formgong.com/submit, access_key fk_your_access_key.
Campos name, email, message e honeypot botcheck.
fetch com Content-Type application/json e Accept: application/json.
Sucesso: result.success. Sem ficheiros.

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

Obter chave