Skip to content
Permalink
51b8822d0a
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
16 lines (13 sloc) 471 Bytes
import { jsonError } from "../../../../common.js";
export async function onRequestPost(context: RequestContext) {
if (typeof context.data.body.approved !== "boolean")
return jsonError("Decision type must be a boolean", 400);
await context.env.D1.prepare(
"UPDATE events SET approved = ?, pending = 0 WHERE id = ?;",
)
.bind(Number(context.data.body.approved), context.data.event.id)
.run();
return new Response(null, {
status: 204,
});
}