1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: race condition when adding users

This commit is contained in:
Ivar Conradi Østhus 2022-02-01 22:43:35 +01:00
parent 2c559af3a6
commit c54ea3a9d4

View File

@ -51,9 +51,11 @@ function AddUserComponent({ roles, addUserToRole }) {
setSelect(false);
};
const handleSelectUser = (evt, value) => {
const handleSelectUser = (evt, selectedUser) => {
setOptions([]);
setUser(value);
if(selectedUser.id) {
setUser(selectedUser);
}
};
const handleRoleChange = evt => {
@ -63,6 +65,7 @@ function AddUserComponent({ roles, addUserToRole }) {
};
const handleSubmit = async evt => {
debugger;
evt.preventDefault();
await addUserToRole(user.id, role.id);
setUser(undefined);