Wire Formspree endpoint and switch form to FormData submission

Sets FORM_ENDPOINT to the live Formspree URL and changes the fetch body
from JSON.stringify to a FormData object so Formspree parses fields
correctly. Drops the now-invalid Content-Type: application/json header
while keeping Accept: application/json. _subject is appended directly to
the FormData. Branded success state and all other page content unchanged.

https://claude.ai/code/session_01UvxyYfFKojskoSWTfeZ7Vj
This commit is contained in:
Claude
2026-05-29 17:56:43 +00:00
parent 291c46f33b
commit 46b7e61695
+4 -6
View File
@@ -250,7 +250,7 @@ html[lang="ko"] em { font-style: normal; color: var(--gold); font-weight: 500; }
// 3. Replace the empty string below with that URL.
// Until this is set, the form submits to a friendly "not configured" message.
// ────────────────────────────────────────────────────────────────
const FORM_ENDPOINT = '';
const FORM_ENDPOINT = 'https://formspree.io/f/xojbbdzv';
(function() {
const form = document.getElementById('orderForm');
@@ -286,17 +286,15 @@ const FORM_ENDPOINT = '';
}
const data = new FormData(form);
const payload = {};
data.forEach((v, k) => { payload[k] = v; });
payload._subject = 'New order — ' + (payload.name || 'unknown') + ' · ' + (payload.fulfillment || '');
data.append('_subject', 'New order — ' + (data.get('name') || 'unknown') + ' · ' + (data.get('fulfillment') || ''));
submitBtn.disabled = true;
submitBtn.textContent = 'Sending…';
fetch(FORM_ENDPOINT, {
method: 'POST',
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
headers: { 'Accept': 'application/json' },
body: data
}).then(function(r) {
if (!r.ok) throw new Error('HTTP ' + r.status);
return r.json().catch(() => ({}));