Added some alerts
This commit is contained in:
parent
3d9bd2ef96
commit
48e53b8768
1 changed files with 4 additions and 1 deletions
|
@ -11,7 +11,6 @@ import { api, APIResponse } from "../API/API";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function DeleteUser(props: { usernameToDelete: string }): boolean {
|
function DeleteUser(props: { usernameToDelete: string }): boolean {
|
||||||
//console.log(props.usernameToDelete); FOR DEBUG
|
|
||||||
let removed = false;
|
let removed = false;
|
||||||
api
|
api
|
||||||
.removeUser(
|
.removeUser(
|
||||||
|
@ -20,12 +19,16 @@ function DeleteUser(props: { usernameToDelete: string }): boolean {
|
||||||
)
|
)
|
||||||
.then((response: APIResponse<User>) => {
|
.then((response: APIResponse<User>) => {
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
|
alert("User has been deleted!");
|
||||||
|
location.reload();
|
||||||
removed = true;
|
removed = true;
|
||||||
} else {
|
} else {
|
||||||
|
alert("User has not been deleted");
|
||||||
console.error(response.message);
|
console.error(response.message);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
alert("User has not been deleted");
|
||||||
console.error("An error occurred during creation:", error);
|
console.error("An error occurred during creation:", error);
|
||||||
});
|
});
|
||||||
return removed;
|
return removed;
|
||||||
|
|
Loading…
Reference in a new issue