From 877854728641a50c5452b6ce0d4bdf7199f9af1f Mon Sep 17 00:00:00 2001 From: regalijan Date: Thu, 19 Oct 2023 16:51:16 -0400 Subject: [PATCH] Make game appeal actions ACTUALLY work now --- components/GameAppealCard.tsx | 19 +++++++++++-------- functions/api/game-appeals/submit.ts | 1 + index.d.ts | 1 + 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/components/GameAppealCard.tsx b/components/GameAppealCard.tsx index 5752892..4a24d95 100644 --- a/components/GameAppealCard.tsx +++ b/components/GameAppealCard.tsx @@ -29,15 +29,18 @@ export default function (props: GameAppealProps) { (document.getElementById("reductPercentage") as HTMLInputElement).value, ); - const actionResponse = await fetch(`/api/game-appeals/${props.roblox_id}`, { - body: JSON.stringify({ - statsReduction: isNaN(statsReduction) ? 0 : statsReduction, - }), - headers: { - "content-type": "application/json", + const actionResponse = await fetch( + `/api/game-appeals/${props.id}/${action}`, + { + body: JSON.stringify({ + statsReduction: isNaN(statsReduction) ? 0 : statsReduction, + }), + headers: { + "content-type": "application/json", + }, + method: "POST", }, - method: "POST", - }); + ); useToast()( actionResponse.ok diff --git a/functions/api/game-appeals/submit.ts b/functions/api/game-appeals/submit.ts index d9b28d6..f29e414 100644 --- a/functions/api/game-appeals/submit.ts +++ b/functions/api/game-appeals/submit.ts @@ -50,6 +50,7 @@ export async function onRequestPost(context: RequestContext) { await context.env.DATA.put( `gameappeal_${appealId}`, JSON.stringify({ + id: appealId, reasonForUnban, roblox_id: id, roblox_username: username, diff --git a/index.d.ts b/index.d.ts index 40846a8..802d264 100644 --- a/index.d.ts +++ b/index.d.ts @@ -36,6 +36,7 @@ declare global { interface GameAppealProps { created_at: number; + id: string; reasonForUnban: string; roblox_id: number; roblox_username: string;