From 3d9bd2ef96050f9f667a8e1adb273b4a96dd18c4 Mon Sep 17 00:00:00 2001 From: Peter KW Date: Thu, 28 Mar 2024 12:38:12 +0100 Subject: [PATCH] Fixed bugs in removeUser api --- frontend/src/API/API.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/src/API/API.ts b/frontend/src/API/API.ts index d898206..41be31a 100644 --- a/frontend/src/API/API.ts +++ b/frontend/src/API/API.ts @@ -186,19 +186,17 @@ export const api: API = { ): Promise> { try { const response = await fetch(`/api/userdelete/${username}`, { - method: "POST", + method: "DELETE", headers: { "Content-Type": "application/json", Authorization: "Bearer " + token, }, body: JSON.stringify(username), }); - if (!response.ok) { - return { success: false, message: "Failed to remove user" }; + return { success: false, message: "Could not remove user" }; } else { - const data = (await response.json()) as User; - return { success: true, data }; + return { success: true }; } } catch (e) { return { success: false, message: "Failed to remove user" };