Signed-off-by: faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-05-04 08:30:15 +03:00
commit 75e03b42f7
99 files changed
+12285

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
import { NextResponse } from "next/server";
export function json<T>(data: T, init?: ResponseInit) {
return NextResponse.json(data, init);
}
export function err(message: string, status = 400) {
return NextResponse.json({ error: message }, { status });
}
export function asResponse(e: unknown): Response {
if (e instanceof Response) return e;
console.error(e);
const msg = e instanceof Error ? e.message : "Internal error";
return NextResponse.json({ error: msg }, { status: 500 });
}