From 0f6cfb947c971c8d2dd7f9e7efb9daf0304b9b24 Mon Sep 17 00:00:00 2001 From: Regalijan Date: Tue, 27 Feb 2024 23:36:37 -0500 Subject: [PATCH] Add body parsing for member delete endpoint --- functions/api/events-team/team-members/user.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/functions/api/events-team/team-members/user.ts b/functions/api/events-team/team-members/user.ts index 2c221e4..0adcc04 100644 --- a/functions/api/events-team/team-members/user.ts +++ b/functions/api/events-team/team-members/user.ts @@ -1,7 +1,15 @@ import { jsonError } from "../../../common.js"; export async function onRequestDelete(context: RequestContext) { - const { id } = context.data.body; + let body: { id?: string } = {}; + + try { + body = await context.request.json(); + } catch { + return jsonError("Invalid body", 400); + } + + const { id } = body; if ( typeof id !== "string" ||