Stuff stuff stuff #44

Merged
PouuleT merged 24 commits from update-node into master 2021-08-30 12:59:08 +00:00
3 changed files with 12 additions and 3 deletions
Showing only changes of commit aa105443e5 - Show all commits

View File

@ -20,10 +20,14 @@ export function updateUser(data) {
);
}
export function deleteUser(username) {
export function deleteUser(username, userId) {
return request(
"ADMIN_DELETE_USER",
configureAxios().delete("/admins/users/" + username),
[() => getUsers()]
null,
{
username,
id: userId,
}
);
}

View File

@ -51,7 +51,7 @@ export const UserEdit = ({ id }) => {
e.preventDefault();
}
if (confirmDelete) {
dispatch(deleteUser(name));
dispatch(deleteUser(user.name, id));
setModal(false);
} else {
setConfirmDelete(true);

View File

@ -17,6 +17,11 @@ export default (state = defaultState, action) =>
break;
}
case "ADMIN_DELETE_USER_FULFILLED": {
draft.users.delete(action.payload.main.id);
break;
}
case "ADMIN_GET_STATS_FULFILLED": {
draft.stats = action.payload.response.data;
break;