feat(store): お問い合わせフォームを Resend API に切り替え(Formspree 廃止)
This commit is contained in:
parent
1017acae0d
commit
4981d32a1e
23
contact.html
23
contact.html
|
|
@ -169,8 +169,7 @@
|
|||
<h1>お問い合わせ</h1>
|
||||
<p class="subtitle">通常 1〜2 営業日以内にご返信します</p>
|
||||
|
||||
<!-- Formspree: https://formspree.io でフォームを作成し、YOUR_FORM_ID を置き換えてください -->
|
||||
<form id="contact-form" action="https://formspree.io/f/YOUR_FORM_ID" method="POST">
|
||||
<form id="contact-form">
|
||||
|
||||
<div class="field">
|
||||
<label for="type" class="required">お問い合わせ種別</label>
|
||||
|
|
@ -205,9 +204,6 @@
|
|||
<textarea id="message" name="message" required placeholder="詳しい状況をお書きください"></textarea>
|
||||
</div>
|
||||
|
||||
<!-- Formspree スパム対策(ハニーポット) -->
|
||||
<input type="text" name="_gotcha" style="display:none">
|
||||
|
||||
<button type="submit" class="submit-btn" id="submit-btn">送信する</button>
|
||||
</form>
|
||||
|
||||
|
|
@ -230,18 +226,27 @@
|
|||
btn.disabled = true;
|
||||
btn.textContent = '送信中...';
|
||||
|
||||
const data = {
|
||||
type: document.getElementById('type').value,
|
||||
name: document.getElementById('name').value,
|
||||
email: document.getElementById('email').value,
|
||||
subject: document.getElementById('subject').value,
|
||||
message: document.getElementById('message').value,
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await fetch(form.action, {
|
||||
const res = await fetch('https://api.soar-enrich.com/api/store/contact', {
|
||||
method: 'POST',
|
||||
body: new FormData(form),
|
||||
headers: { Accept: 'application/json' }
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
form.style.display = 'none';
|
||||
success.style.display = 'block';
|
||||
} else {
|
||||
alert('送信に失敗しました。時間をおいて再度お試しください。');
|
||||
const err = await res.json().catch(() => ({}));
|
||||
alert(err.error || '送信に失敗しました。時間をおいて再度お試しください。');
|
||||
btn.disabled = false;
|
||||
btn.textContent = '送信する';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue