Auto refresh on vote super admin

This commit is contained in:
Maxime Lalo 2023-10-05 17:26:09 +02:00
parent e96fdf617c
commit 8773e5f25b

View File

@ -69,9 +69,9 @@ export default function UserInformations(props: IProps) {
});
if (!user) return;
const roles = await Roles.getInstance().get({
where: {NOT: {OR:[{name: "super-admin"}, {name: "admin"}]}},
where: { NOT: { OR: [{ name: "super-admin" }, { name: "admin" }] } },
});
if (!roles) return
if (!roles) return;
setAvailableRoles(roles.map((role) => ({ value: role.uid, label: role.label })));
setUserSelected(user);
}, [userUid]);
@ -140,8 +140,9 @@ export default function UserInformations(props: IProps) {
}),
);
}
getUser();
setIsAdminModalOpened(false);
}, [userSelected, adminModalType]);
}, [userSelected, adminModalType, getUser]);
/** Functions for the super admin modal */
const openSuperAdminModal = () => {
@ -286,7 +287,7 @@ export default function UserInformations(props: IProps) {
<Typography typo={ITypo.P_SB_18}>Attribuer un titre</Typography>
</div>
<div className={classes["second-line"]}>
{!isSuperAdminChecked && (
{!isSuperAdminChecked && !currentAppointment && (
<Switch label="Admin de son office" checked={isAdminChecked} onChange={handleAdminChanged} />
)}