pre-bemis

This commit is contained in:
Marcelo
2026-04-22 05:04:19 +00:00
parent ac1a7900c8
commit 80d27f83b6
91 changed files with 11769 additions and 820 deletions

View File

@@ -0,0 +1,31 @@
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import { logLine } from "@/lib/logger";
export const dynamic = "force-dynamic";
type PerfPayload = {
event?: string;
data?: Record<string, unknown>;
};
export async function POST(req: NextRequest) {
try {
const body = (await req.json()) as PerfPayload;
const type = typeof body?.event === "string" ? body.event : "nav";
const data = body?.data && typeof body.data === "object" ? body.data : {};
const userAgent = req.headers.get("user-agent") ?? "";
logLine("perf.client", {
type,
userAgent,
...data,
});
return NextResponse.json({ ok: true });
} catch (err) {
const message = err instanceof Error ? err.message : String(err);
logLine("perf.client.error", { message });
return NextResponse.json({ ok: false, error: "Bad payload" }, { status: 400 });
}
}