Greatly reduce repeated code

This commit is contained in:
2023-10-19 16:50:48 -04:00
parent 47e639be43
commit dd2d9f2672
34 changed files with 196 additions and 481 deletions

View File

@ -1,5 +1,6 @@
import { insertLogs } from "../../../gcloud.js";
import { getBanList, setBanList } from "../../../roblox-open-cloud.js";
import { insertLogs } from "../../../gcloud.js";
import { jsonError } from "../../../common.js";
export async function onRequestPost(context: RequestContext) {
const actionMap = context.data.body;
@ -13,11 +14,7 @@ export async function onRequestPost(context: RequestContext) {
action < 0 ||
action > 2
)
return new Response('{"error":"Invalid action map"}', {
headers: {
"content-type": "application/json",
},
});
return jsonError("Invalid action map", 400);
if (action === 0) continue;