This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import { jsonBody } from '$lib/server/request-body.js';
|
||||
import { isHttpError, json } from '@sveltejs/kit';
|
||||
import { watchdogDetail, updateWatchdogIncident } from '$lib/server/maintenance/recovery.js';
|
||||
import { kick } from '$lib/server/pipeline/worker.js';
|
||||
|
||||
@@ -9,7 +10,10 @@ export function GET({ params }: { params: { id: string } }) {
|
||||
: json({ error: 'Maintenance finding not found.' }, { status: 404 });
|
||||
}
|
||||
export async function POST({ params, request }: { params: { id: string }; request: Request }) {
|
||||
const body = await request.json().catch(() => null);
|
||||
const body = await jsonBody(request).catch((cause) => {
|
||||
if (isHttpError(cause, 413)) throw cause;
|
||||
return null;
|
||||
});
|
||||
if (!body || !['retry', 'dismiss'].includes(body.action))
|
||||
return json({ error: 'Choose retry or dismiss.' }, { status: 400 });
|
||||
const result = updateWatchdogIncident(params.id, body.action);
|
||||
|
||||
Reference in New Issue
Block a user