diff --git a/src/front/Components/Layouts/Collaborators/CollaboratorInformations/index.tsx b/src/front/Components/Layouts/Collaborators/CollaboratorInformations/index.tsx index ae31697a..617838d6 100644 --- a/src/front/Components/Layouts/Collaborators/CollaboratorInformations/index.tsx +++ b/src/front/Components/Layouts/Collaborators/CollaboratorInformations/index.tsx @@ -56,26 +56,30 @@ export default function CollaboratorInformations(props: IProps) { }, [selectedOption, userSelected]); const changeAdmin = useCallback(async () => { - if (adminRoleType === "add") { - const adminRole = await Roles.getInstance().getOne({ - where: { - name: "admin", - }, - }); + try { + if (adminRoleType === "add") { + const adminRole = await Roles.getInstance().getOne({ + where: { + name: "admin", + }, + }); - if (!adminRole) return; - await Users.getInstance().put( - userSelected?.uid as string, - User.hydrate({ - uid: userSelected?.uid as string, - office_role: undefined, - role: adminRole, - }), - ); - } else { - // retirer rôle admin + if (!adminRole) return; + await Users.getInstance().put( + userSelected?.uid as string, + User.hydrate({ + uid: userSelected?.uid as string, + office_role: undefined, + role: adminRole, + }), + ); + } else { + // retirer rôle admin + } + setAdminModalOpened(false); + } catch (e) { + console.error(e); } - setRoleModalOpened(false); }, [adminRoleType, userSelected]); const openAdminModal = useCallback((e: React.ChangeEvent) => { diff --git a/src/front/Components/Layouts/Collaborators/index.tsx b/src/front/Components/Layouts/Collaborators/index.tsx index 90e43453..00314e81 100644 --- a/src/front/Components/Layouts/Collaborators/index.tsx +++ b/src/front/Components/Layouts/Collaborators/index.tsx @@ -1,8 +1,8 @@ import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography"; +import DefaultCollaboratorDashboard from "@Front/Components/LayoutTemplates/DefaultCollaboratorDashboard"; import BasePage from "../Base"; import classes from "./classes.module.scss"; -import DefaultCollaboratorDashboard from "@Front/Components/LayoutTemplates/DefaultCollaboratorDashboard"; type IProps = {}; type IState = {}; @@ -12,7 +12,7 @@ export default class Collaborators extends BasePage {
- Informations du collaboraeur + Informations du collaborateur
Sélectionnez un collaborateur