Fixed bugs in removeUser api

This commit is contained in:
Peter KW 2024-03-28 12:38:12 +01:00
parent 50042ded41
commit 3d9bd2ef96

View file

@ -186,19 +186,17 @@ export const api: API = {
): Promise<APIResponse<User>> {
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" };