feat:Integrate Contact Form with Strapi Backend (Create + Fetch + Connect)
Description:
Currently, the Contact Form UI is already implemented in the frontend. However, it is not connected to the Strapi backend and throws an error on submission.
The goal is to create a backend collection for storing contact form submissions and integrate it with the frontend so that data can be successfully sent and stored.
Backend Tasks (Strapi):
-
Create a new collection type: Contact Submission -
Add fields: - name (text, required)
- email (email, required)
- message (long text, required)
- submitted_at (datetime, optional)
-
Enable public permissions: - create
- find
Frontend Tasks:
-
Identify current API call used in contact form submission -
Replace or update API endpoint to: POST /api/contact-submissions -
Ensure request payload format:
{
"data": {
"name": "",
"email": "",
"message": ""
}
}
-
Add console logs to debug API response -
Handle success and error responses properly
Fetch Verification:
-
Test API manually using: GET /api/contact-submissions -
Confirm that submitted data is stored and retrievable
Expected Outcome:
- Contact form submits successfully without errors
- Data is stored in Strapi backend
- API returns stored submissions correctly
- Error message ("There was an error submitting your message") is resolved
Notes:
- Frontend already exists at
/contact - Backend (Strapi) needs to be integrated
- Ensure CORS and permissions are properly configured
- This is part of enabling dynamic backend-driven forms