Skip to content

Commit d145f56

Browse files
committed
fix: use accessKey instead of apiKey for Static Forms API
1 parent a27fe83 commit d145f56

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/components/ContactModal.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useToast } from '../contexts/ToastContext'
66
import { useContactModal } from '../contexts/ContactModalContext'
77
import { INPUT_BASE_CLASSES } from './ui/inputStyles'
88

9-
const STATIC_FORMS_API_KEY = 'sf_h86a9a9760cijki4amg2ikb7'
9+
const STATIC_FORMS_ACCESS_KEY = 'sf_h86a9a9760cijki4amg2ikb7'
1010

1111
export default function ContactModal() {
1212
const { t } = useTranslation('common')
@@ -43,7 +43,7 @@ export default function ContactModal() {
4343
'Content-Type': 'application/json',
4444
},
4545
body: JSON.stringify({
46-
apiKey: STATIC_FORMS_API_KEY,
46+
accessKey: STATIC_FORMS_ACCESS_KEY,
4747
subject: 'Contact from Folio website',
4848
name: name.trim(),
4949
email: email.trim(),
@@ -52,13 +52,17 @@ export default function ContactModal() {
5252
}),
5353
})
5454

55-
if (response.ok) {
55+
const data = await response.json()
56+
57+
if (response.ok && data.success) {
5658
showSuccess(t('contactModal.success', 'Message sent! We\'ll get back to you soon.'))
5759
handleClose()
5860
} else {
61+
console.error('Static Forms error:', data)
5962
showError(t('contactModal.error', 'Failed to send message. Please try again.'))
6063
}
61-
} catch {
64+
} catch (error) {
65+
console.error('Contact form error:', error)
6266
showError(t('contactModal.error', 'Failed to send message. Please try again.'))
6367
} finally {
6468
setIsSubmitting(false)

0 commit comments

Comments
 (0)