Skip to content

Commit

Permalink
Merge pull request #44 from Honeybrain/fix-bug-update-user
Browse files Browse the repository at this point in the history
🐛 Fix a bug when update user shuffle list
  • Loading branch information
valentinbreiz authored Jan 17, 2024
2 parents 469148c + 1284849 commit 5607a8b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/dashboard/UsersManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ const UsersManagement: React.FC = () => {

const changeRightsClick = (user: UserDto, roles: number[]) =>
changeRights(user.email, roles)
.then((newUser) =>
setUsers((x) => [
...x.filter((y) => y.id != user.id),
newUser.response,
]),
)
.then((newUser) => {
const user = users.find((x) => x.id == newUser.response.id);
if (!user) return;
user.roles = newUser.response.roles;
setUsers([...users]);
})
.catch(() =>
setAlert({
content:
Expand Down

0 comments on commit 5607a8b

Please sign in to comment.