Skip to content
Permalink
Newer
Older
100644 22 lines (15 sloc) 660 Bytes
October 19, 2023 16:51
1
import { jsonError, jsonResponse } from "../../common.js";
2
import precheck from "./precheck.js";
3
4
export async function onRequestPost(context: RequestContext) {
6
context.request.headers.get("rbx-auth") !==
7
context.env.ROBLOX_APPEALS_TOKEN
8
)
9
return jsonError("Unauthorized", 401);
10
October 19, 2023 16:51
11
const { id }: { id: any } = context.data.body;
12
13
if (typeof id !== "number") return jsonError("Invalid user id", 400);
14
15
const precheckData = await precheck(context, id);
16
17
if (precheckData.error) return jsonError(precheckData.error, 500);
18
19
const { can_appeal, reason } = precheckData;
20
21
return jsonResponse(JSON.stringify({ can_appeal, reason }));
22
}