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 {
|
||||
retentionPreview,
|
||||
retentionControls,
|
||||
@@ -22,9 +23,10 @@ export function GET() {
|
||||
}
|
||||
export async function POST({ request }: { request: Request }) {
|
||||
try {
|
||||
setRetentionControl(await request.json());
|
||||
setRetentionControl(await jsonBody(request));
|
||||
return json({ ok: true });
|
||||
} catch (error) {
|
||||
if (isHttpError(error, 413)) throw error;
|
||||
return json({ error: (error as Error).message }, { status: 400 });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user