project setup

This commit is contained in:
Sone
2025-11-02 10:00:53 +01:00
parent 75bd171804
commit 7cb4c5345e
51 changed files with 3616 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
import { saveContact } from "@/lib/contactStore";
import { contactSchema } from "@/schemas/schemas";
export async function POST(req: Request) {
try {
const body = await req.json();
const {
firstName,
lastName,
companyName,
address,
email,
phone,
industry,
notes,
subscribe,
} = contactSchema.parse(body);
const saved = await saveContact({
firstName,
lastName,
companyName,
address,
email,
phone,
industry,
notes,
subscribe,
});
return Response.json({ success: true, id: saved.id });
} catch (err: any) {
if (err?.issues) {
return Response.json(
{ success: false, errors: err.issues },
{ status: 400 }
);
}
return Response.json({ success: false }, { status: 500 });
}
}