v0のフォーム

Server ActionsもResendも使わないでください。Formgongへのfetchで足ります。

  1. 下のプロンプトでセクションを作る。
  2. AcceptとContent-Typeを確認する。
  3. 成功はJSONの 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");
}

キーを取得