feat: initial Funktechnik Schubert website
This commit is contained in:
commit
9a648e2ec8
35 changed files with 7521 additions and 0 deletions
25
app/api/contact/route.ts
Normal file
25
app/api/contact/route.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { NextResponse } from "next/server";
|
||||
|
||||
function text(value: FormDataEntryValue | null) {
|
||||
return typeof value === "string" ? value.trim() : "";
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const form = await request.formData();
|
||||
const name = text(form.get("name"));
|
||||
const email = text(form.get("email"));
|
||||
const message = text(form.get("message"));
|
||||
|
||||
if (!name || !email.includes("@") || message.length < 10 || form.get("privacy") !== "on") {
|
||||
return NextResponse.json({ message: "Bitte füllen Sie alle Pflichtfelder aus." }, { status: 400 });
|
||||
}
|
||||
|
||||
console.info("contact_request.received", {
|
||||
messageLength: message.length,
|
||||
hasEmail: true,
|
||||
});
|
||||
|
||||
return NextResponse.json({
|
||||
message: "Ihre Nachricht wurde erfasst. Sie erhalten eine Rückmeldung.",
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue