Add Mailgun admin tools and contact API

This commit is contained in:
2025-09-24 13:59:26 +00:00
parent 6329ad0618
commit 1054f5d817
13 changed files with 1459 additions and 29 deletions

View File

@@ -50,20 +50,30 @@ export default function Contact() {
setIsSubmitting(true)
try {
// Simulate form submission
await new Promise(resolve => setTimeout(resolve, 1000))
// Here you would typically send the data to your API
console.log('Form submitted:', formData)
setFormData({
name: '',
email: '',
subject: '',
message: ''
const response = await fetch('/api/contact', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(formData)
})
setShowSuccess(true)
const data = await response.json()
if (response.ok && data.success) {
setFormData({
name: '',
email: '',
subject: '',
message: ''
})
setShowSuccess(true)
} else {
console.error('Contact form error:', data.error)
setShowError(true)
}
} catch (error) {
console.error('Contact form submission error:', error)
setShowError(true)
} finally {
setIsSubmitting(false)