Initial react editor website template

This commit is contained in:
Rami Bitar
2026-08-29 14:03:50 -04:00
commit 3e072967e6
61 changed files with 7041 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
import { NextResponse } from 'next/server';
import { z } from 'zod';
const contactSchema = z.object({
name: z.string().trim().min(2, 'Please enter your name.').max(100),
email: z.string().trim().email('Please enter a valid email address.').max(254),
company: z.string().trim().max(120).optional().default(''),
message: z.string().trim().min(10, 'Please share a little more detail.').max(5000),
website: z.string().max(0).optional().default(''),
});
export async function POST(request: Request) {
try {
const payload: unknown = await request.json();
const result = contactSchema.safeParse(payload);
if (!result.success) {
return NextResponse.json(
{ error: result.error.issues[0]?.message ?? 'Please check the form and try again.' },
{ status: 400 }
);
}
// Store the validated contact data here.
// For example: await db.contactSubmission.create({ data: result.data });
return NextResponse.json({ ok: true }, { status: 202 });
} catch {
return NextResponse.json({ error: 'Invalid request.' }, { status: 400 });
}
}