Greatly reduce repeated code
This commit is contained in:
@ -1,15 +1,11 @@
|
||||
import { jsonError } from "../../../common.js";
|
||||
|
||||
export async function onRequestPost(context: RequestContext) {
|
||||
const appealId = context.params.id as string;
|
||||
|
||||
const appeal = await context.env.DATA.get(`gameappeal_${appealId}`);
|
||||
|
||||
if (!appeal)
|
||||
return new Response('{"error":"Appeal not found"}', {
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
},
|
||||
status: 404,
|
||||
});
|
||||
if (!appeal) return jsonError("Appeal not found", 404);
|
||||
|
||||
const appealData = JSON.parse(appeal);
|
||||
|
||||
|
Reference in New Issue
Block a user