Files
Firefly_Srtools/src/app/api/[locale]/pf/route.ts
AzenKain afdb92cc2d
Some checks failed
Gitea Auto Deploy / Deploy-Container (push) Failing after 1m25s
UPDATE: next16 and minifyjson
2025-11-18 14:09:00 +07:00

23 lines
756 B
TypeScript

import { loadPF } from "@/lib/loader";
import { NextRequest, NextResponse } from "next/server";
export async function POST(request: NextRequest, { params }: { params: Promise<{ locale: string }> }) {
try {
const body = await request.json();
const pfIds = body.pfIds as string[];
const { locale } = await params;
if (!Array.isArray(pfIds) || pfIds.some(id => typeof id !== 'string')) {
return NextResponse.json({ error: 'Invalid pfIds' }, { status: 400 });
}
const pfData = await loadPF(pfIds, locale);
return new NextResponse(JSON.stringify(pfData), {
headers: { "Content-Type": "application/json" }
});
} catch {
return NextResponse.json({ error: 'Failed to load pf data' }, { status: 500 });
}
}