* Force refresh of user after save to avoid modal (#3180) * Update src/user/UsersTabs.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * Update src/user/UsersTabs.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> * Update src/user/UsersTabs.tsx Co-authored-by: Jon Koops <jonkoops@gmail.com> Co-authored-by: Jon Koops <jonkoops@gmail.com>
This commit is contained in:
parent
0b509131cc
commit
8c9917ddff
1 changed files with 4 additions and 1 deletions
|
@ -46,6 +46,8 @@ const UsersTabs = () => {
|
|||
const [user, setUser] = useState<UserRepresentation>();
|
||||
const [bruteForced, setBruteForced] = useState<BruteForced>();
|
||||
const [addedGroups, setAddedGroups] = useState<GroupRepresentation[]>([]);
|
||||
const [refreshCount, setRefreshCount] = useState(0);
|
||||
const refresh = () => setRefreshCount((count) => count + 1);
|
||||
|
||||
useFetch(
|
||||
async () => {
|
||||
|
@ -72,7 +74,7 @@ const UsersTabs = () => {
|
|||
setBruteForced(bruteForced);
|
||||
user && setupForm(user);
|
||||
},
|
||||
[user?.username]
|
||||
[user?.username, refreshCount]
|
||||
);
|
||||
|
||||
const setupForm = (user: UserRepresentation) => {
|
||||
|
@ -90,6 +92,7 @@ const UsersTabs = () => {
|
|||
if (id) {
|
||||
await adminClient.users.update({ id }, user);
|
||||
addAlert(t("userSaved"), AlertVariant.success);
|
||||
refresh();
|
||||
} else {
|
||||
const createdUser = await adminClient.users.create(user);
|
||||
|
||||
|
|
Loading…
Reference in a new issue