Cancel run

This commit is contained in:
2026-02-08 14:22:45 +01:00
parent bcea0c495c
commit 239770c8b6
+20 -2
View File
@@ -36,10 +36,10 @@ export async function PUT(req: NextRequest) {
} }
export async function POST(req: NextRequest) { export async function POST(req: NextRequest) {
const { runId } = await req.json(); const runId = req.nextUrl.searchParams.get("runId");
if (!runId) if (!runId)
return NextResponse.json({ error: "body requires runId" }, { status: 400 }); return NextResponse.json({ error: "missing ?runId=" }, { status: 400 });
const supabase = await createClient(); const supabase = await createClient();
@@ -60,3 +60,21 @@ export async function POST(req: NextRequest) {
return NextResponse.json({ ok: true, run }); return NextResponse.json({ ok: true, run });
} }
export async function DELETE(req: NextRequest) {
const { runId } = await req.json();
if (!runId)
return NextResponse.json({ error: "body requires runId" }, { status: 400 });
const supabase = await createClient();
const session = await getSession(supabase);
if (!session)
return NextResponse.json({ error: "Invalid session" }, { status: 401 });
const run = await Core.removeLiveRun(runId);
return NextResponse.json({ ok: true, run });
}