🐛 Small bug fixes

This commit is contained in:
Maxime Lalo 2023-07-26 11:10:07 +02:00
parent 406ebeb2cc
commit 1179d88811
2 changed files with 24 additions and 20 deletions

View File

@ -56,26 +56,30 @@ export default function CollaboratorInformations(props: IProps) {
}, [selectedOption, userSelected]); }, [selectedOption, userSelected]);
const changeAdmin = useCallback(async () => { const changeAdmin = useCallback(async () => {
if (adminRoleType === "add") { try {
const adminRole = await Roles.getInstance().getOne({ if (adminRoleType === "add") {
where: { const adminRole = await Roles.getInstance().getOne({
name: "admin", where: {
}, name: "admin",
}); },
});
if (!adminRole) return; if (!adminRole) return;
await Users.getInstance().put( await Users.getInstance().put(
userSelected?.uid as string, userSelected?.uid as string,
User.hydrate<User>({ User.hydrate<User>({
uid: userSelected?.uid as string, uid: userSelected?.uid as string,
office_role: undefined, office_role: undefined,
role: adminRole, role: adminRole,
}), }),
); );
} else { } else {
// retirer rôle admin // retirer rôle admin
}
setAdminModalOpened(false);
} catch (e) {
console.error(e);
} }
setRoleModalOpened(false);
}, [adminRoleType, userSelected]); }, [adminRoleType, userSelected]);
const openAdminModal = useCallback((e: React.ChangeEvent<HTMLInputElement>) => { const openAdminModal = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {

View File

@ -1,8 +1,8 @@
import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography"; import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography";
import DefaultCollaboratorDashboard from "@Front/Components/LayoutTemplates/DefaultCollaboratorDashboard";
import BasePage from "../Base"; import BasePage from "../Base";
import classes from "./classes.module.scss"; import classes from "./classes.module.scss";
import DefaultCollaboratorDashboard from "@Front/Components/LayoutTemplates/DefaultCollaboratorDashboard";
type IProps = {}; type IProps = {};
type IState = {}; type IState = {};
@ -12,7 +12,7 @@ export default class Collaborators extends BasePage<IProps, IState> {
<DefaultCollaboratorDashboard title={"Dossier"} mobileBackText={"Liste des collaborateurs"}> <DefaultCollaboratorDashboard title={"Dossier"} mobileBackText={"Liste des collaborateurs"}>
<div className={classes["root"]}> <div className={classes["root"]}>
<div className={classes["no-folder-selected"]}> <div className={classes["no-folder-selected"]}>
<Typography typo={ITypo.H1Bis}>Informations du collaboraeur</Typography> <Typography typo={ITypo.H1Bis}>Informations du collaborateur</Typography>
<div className={classes["choose-a-folder"]}> <div className={classes["choose-a-folder"]}>
<Typography typo={ITypo.P_18} color={ITypoColor.GREY}> <Typography typo={ITypo.P_18} color={ITypoColor.GREY}>
Sélectionnez un collaborateur Sélectionnez un collaborateur