Fixed bugs in removeUser api
This commit is contained in:
parent
50042ded41
commit
3d9bd2ef96
1 changed files with 3 additions and 5 deletions
|
@ -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" };
|
||||
|
|
Loading…
Reference in a new issue