Skip to content

Conversation

@dariodjuric
Copy link
Owner

  • Replaced the API route /api/contact with a Next.js Server Action for handling contact form submissions.
  • Created app/contact/actions.ts to house the sendContactEmail server action, which includes email sending logic via SMTP2Go, basic validation, and error handling.
  • Updated components/ContactForm.tsx to use the new server action with useFormState for managing server responses and maintaining client-side validation with react-hook-form.
  • Deleted the old API route file app/api/contact/route.ts.

- Replaced the API route `/api/contact` with a Next.js Server Action for handling contact form submissions.
- Created `app/contact/actions.ts` to house the `sendContactEmail` server action, which includes email sending logic via SMTP2Go, basic validation, and error handling.
- Updated `components/ContactForm.tsx` to use the new server action with `useFormState` for managing server responses and maintaining client-side validation with `react-hook-form`.
- Deleted the old API route file `app/api/contact/route.ts`.

This change modernizes the form submission process, aligning with current Next.js best practices.
@vercel
Copy link

vercel bot commented May 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
darios-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 21, 2025 6:24am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants