Compare commits

..

2 Commits

2 changed files with 15 additions and 10 deletions

View File

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

View File

@ -30,7 +30,7 @@
}, },
{ {
"key": "Content-Security-Policy", "key": "Content-Security-Policy",
"value": "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://unpkg.com https://cdn.jsdelivr.net https://esm.sh; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://fonts.gstatic.com; font-src 'self' data: https://fonts.gstatic.com; img-src 'self' data: https:; media-src 'self' https:; connect-src 'self' https://api.soar-enrich.com wss://api.soar-enrich.com https:; worker-src 'self'; frame-ancestors 'none';" "value": "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://unpkg.com https://cdn.jsdelivr.net https://esm.sh; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://fonts.gstatic.com https://posimai-ui.vercel.app; font-src 'self' data: https://fonts.gstatic.com; img-src 'self' data: https:; media-src 'self' https:; connect-src 'self' https://api.soar-enrich.com wss://api.soar-enrich.com https:; worker-src 'self'; frame-ancestors 'none';"
}, },
{ {
"key": "Strict-Transport-Security", "key": "Strict-Transport-Security",