refactor: consolidate contact API logic and enhance error handling

- Migrate contact API from route.tsx to route.ts for improved organization.
- Implement filtering, pagination, and rate limiting for GET and POST requests.
- Enhance error handling for database operations, including graceful handling of missing tables.
- Validate input fields and email format in POST requests to ensure data integrity.
This commit is contained in:
2026-01-10 03:13:03 +01:00
parent 40d9489395
commit 59cc8ee154
4 changed files with 138 additions and 160 deletions

View File

@@ -59,7 +59,7 @@ const ToastItem = ({ toast, onRemove }: ToastProps) => {
const getColors = () => {
switch (toast.type) {
case 'success':
return 'bg-stone-50 border-green-200 text-green-800 shadow-md';
return 'bg-stone-50 border-green-300 text-green-900 shadow-md';
case 'error':
return 'bg-stone-50 border-red-200 text-red-800 shadow-md';
case 'warning':
@@ -291,7 +291,7 @@ export const ToastProvider = ({ children }: { children: React.ReactNode }) => {
{children}
{/* Toast Container */}
<div className="fixed top-4 right-4 z-50 space-y-2 max-w-xs">
<div className="fixed top-4 right-4 z-50 space-y-3 max-w-sm">
<AnimatePresence>
{toasts.map((toast) => (
<ToastItem