Files
2026-03-24 15:46:27 +03:00

25 lines
852 B
TypeScript

import { NextRequest, NextResponse } from "next/server";
import { appleApiRequest } from "@/app/asc/api";
// PATCH /api/asc/screenshots/commit { screenshotId, md5, ... }
// Step 3: Commit the uploaded screenshot to mark upload as complete
export async function PATCH(req: NextRequest) {
const body = await req.json();
const { screenshotId } = body ?? {};
if (!screenshotId) return NextResponse.json({ error: "screenshotId gerekli" }, { status: 400 });
const result = await appleApiRequest(`/appScreenshots/${screenshotId}`, {
method: "PATCH",
body: JSON.stringify({
data: {
type: "appScreenshots",
id: screenshotId,
attributes: { uploaded: true },
},
}),
});
if (result.error) return NextResponse.json({ error: result.error }, { status: 502 });
return NextResponse.json(result.data);
}