import { NextResponse } from "next/server"; import { withAuth } from "@/lib/api-auth"; import { apiError, handleApiError } from "@/lib/api-errors"; import { BenchmarkError, cancelBenchmark } from "@/lib/benchmarks"; export const POST = withAuth>(async (_req, { params }) => { try { await cancelBenchmark((await params).id); return new NextResponse(null, { status: 202 }); } catch (err) { if (err instanceof BenchmarkError) return apiError(err.status, err.code, err.message); return handleApiError(err); } });