Replace fabricated Web3Forms with FormSubmit for contact/newsletter forms
All checks were successful
Build and Deploy to Storj / build-and-deploy (push) Successful in 11s
All checks were successful
Build and Deploy to Storj / build-and-deploy (push) Successful in 11s
This commit is contained in:
parent
1ff39c5d4f
commit
a8b360ab41
2 changed files with 6 additions and 43 deletions
|
|
@ -142,40 +142,12 @@ const topicParam = Astro.url.searchParams.get('topic');
|
|||
errorEl.textContent = '';
|
||||
|
||||
try {
|
||||
// POST form data to Web3Forms API
|
||||
const formData = new FormData(form);
|
||||
|
||||
// Build subject based on form type
|
||||
let subject = '';
|
||||
if (type === 'speaking') {
|
||||
subject = 'Speaking Inquiry - Scott Scoble Brand Site';
|
||||
} else if (type === 'contact') {
|
||||
subject = 'Contact Form - Scott Scoble Brand Site';
|
||||
} else if (type === 'waitlist') {
|
||||
subject = 'Dark Provenance Waitlist Interest';
|
||||
}
|
||||
|
||||
// Collect field data
|
||||
let body = '';
|
||||
formData.forEach((value, key) => {
|
||||
if (key !== '_gotcha' && value) {
|
||||
body += `${key}: ${value}\n`;
|
||||
}
|
||||
});
|
||||
|
||||
// Prepare payload for Web3Forms
|
||||
const payload = {
|
||||
access_key: 'e6e6c7ab-3a0f-49b1-ac78-0f2f2fe84cbe',
|
||||
subject: subject,
|
||||
from_name: formData.get('name') || 'Brand Site Visitor',
|
||||
email: formData.get('email') || 'no-reply@scott.scoble.me',
|
||||
message: body,
|
||||
};
|
||||
|
||||
const response = await fetch('https://api.web3forms.com/submit', {
|
||||
// Use FormSubmit — free, no registration, delivers to scott@scoble.me
|
||||
const response = await fetch('https://formsubmit.co/ajax/scott@scoble.me', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload),
|
||||
body: formData,
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
|
|
|||
|
|
@ -48,20 +48,11 @@ const {
|
|||
|
||||
try {
|
||||
const formData = new FormData(form);
|
||||
const email = formData.get('email');
|
||||
formData.append('_subject', 'Newsletter Subscribe - Scott Scoble');
|
||||
|
||||
const payload = {
|
||||
access_key: 'e6e6c7ab-3a0f-49b1-ac78-0f2f2fe84cbe',
|
||||
subject: 'Newsletter Subscribe - Scott Scoble',
|
||||
from_name: email,
|
||||
email: email,
|
||||
message: `New newsletter subscriber: ${email}`,
|
||||
};
|
||||
|
||||
const response = await fetch('https://api.web3forms.com/submit', {
|
||||
const response = await fetch('https://formsubmit.co/ajax/scott@scoble.me', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload),
|
||||
body: formData,
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue