Permalink
Newer
100644
22 lines (15 sloc)
660 Bytes
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
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
}