create constants for user roles

This commit is contained in:
memeriau 2022-05-02 20:46:54 +02:00
parent 514cf1b833
commit 42586c7fde
3 changed files with 14 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import { selectTeamList } from "../../store/teamList"
import TeamWithCandidates from "./TeamWithCandidates" import TeamWithCandidates from "./TeamWithCandidates"
import styles from "./styles.module.scss" import styles from "./styles.module.scss"
import withUserRole from "../../utils/withUserRole" import withUserRole from "../../utils/withUserRole"
import ROLES from "../../utils/roles.constants"
const TeamsWithCandidates: FC = (): JSX.Element => { const TeamsWithCandidates: FC = (): JSX.Element => {
const teams = useSelector(selectTeamList) const teams = useSelector(selectTeamList)
@ -26,4 +27,4 @@ const TeamsWithCandidates: FC = (): JSX.Element => {
) )
} }
export default withUserRole("répartiteur", memo(TeamsWithCandidates)) export default withUserRole(ROLES.ASSIGNER, memo(TeamsWithCandidates))

View File

@ -8,6 +8,7 @@ import styles from "./styles.module.scss"
import { Volunteer } from "../../services/volunteers" import { Volunteer } from "../../services/volunteers"
import { Team } from "../../services/teams" import { Team } from "../../services/teams"
import withUserRole from "../../utils/withUserRole" import withUserRole from "../../utils/withUserRole"
import ROLES from "../../utils/roles.constants"
interface ExtendedVolunteer extends Volunteer { interface ExtendedVolunteer extends Volunteer {
teamObject: Team | undefined teamObject: Team | undefined
@ -31,7 +32,7 @@ type VolunteerEmailProps = {
email: string email: string
} }
const VolunteerEmail: FC<VolunteerEmailProps> = withUserRole("référent", ({ email }) => ( const VolunteerEmail: FC<VolunteerEmailProps> = withUserRole(ROLES.TEAMLEAD, ({ email }) => (
<div className={styles.volunteerEmail}>{email}</div> <div className={styles.volunteerEmail}>{email}</div>
)) ))

View File

@ -0,0 +1,10 @@
type rolesType = {
[key: string]: string
}
const ROLES: rolesType = {
ASSIGNER: "répartiteur",
TEAMLEAD: "référent",
}
export default ROLES