route.ts 384 B

123456789101112131415
  1. import { reorderWidgets } from "@/lib/db/store";
  2. export async function POST(req: Request) {
  3. const body = await req.json();
  4. if (!body.orderedIds || !Array.isArray(body.orderedIds)) {
  5. return Response.json(
  6. { error: "orderedIds array is required" },
  7. { status: 400 },
  8. );
  9. }
  10. await reorderWidgets(body.orderedIds);
  11. return Response.json({ success: true });
  12. }