Greatly reduce repeated code
This commit is contained in:
@ -1,13 +1,9 @@
|
||||
import { jsonError } from "../../common.js";
|
||||
|
||||
export async function onRequestPost(context: RequestContext) {
|
||||
const { user } = context.data.body;
|
||||
|
||||
if (!user)
|
||||
return new Response('{"error":"No user provided"}', {
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
},
|
||||
status: 400,
|
||||
});
|
||||
if (!user) return jsonError("No user provided", 400);
|
||||
|
||||
await context.env.DATA.delete(`gamemod_${user}`);
|
||||
|
||||
|
Reference in New Issue
Block a user