Update AboutUsPage, server routes, packages, and assets
This commit is contained in:
@@ -31,8 +31,7 @@ export default function ContactSection({ isMobile, onOpenStrategy }) {
|
||||
setErrorMsg('');
|
||||
|
||||
try {
|
||||
// Try sending via API endpoint
|
||||
const response = await fetch('/api/send', {
|
||||
let response = await fetch('/api/contact', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
@@ -40,21 +39,36 @@ export default function ContactSection({ isMobile, onOpenStrategy }) {
|
||||
name: formData.name,
|
||||
email: formData.email,
|
||||
phone: formData.phone,
|
||||
interests: formData.subject,
|
||||
subject: formData.subject,
|
||||
message: formData.message
|
||||
})
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
if (!response.ok) {
|
||||
response = await fetch('/api/send', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
type: 'contact',
|
||||
name: formData.name,
|
||||
email: formData.email,
|
||||
phone: formData.phone,
|
||||
subject: formData.subject,
|
||||
message: formData.message
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
const resData = await response.json().catch(() => ({}));
|
||||
|
||||
if (response.ok && resData.success) {
|
||||
setSubmitted(true);
|
||||
setFormData({ name: '', email: '', phone: '', subject: '', message: '' });
|
||||
} else {
|
||||
// Fallback smooth demo success if backend API is not configured with live EmailJS keys
|
||||
setSubmitted(true);
|
||||
setFormData({ name: '', email: '', phone: '', subject: '', message: '' });
|
||||
setErrorMsg(resData.error || resData.smtpError || 'Failed to send message. Please check SMTP configuration.');
|
||||
}
|
||||
} catch {
|
||||
// Graceful fallback for local development without server
|
||||
} catch (err) {
|
||||
console.error('Contact submit error:', err);
|
||||
setSubmitted(true);
|
||||
setFormData({ name: '', email: '', phone: '', subject: '', message: '' });
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user