diff --git a/frontend/src/routes/sponsor/guest/newGuestRole/index.tsx b/frontend/src/routes/sponsor/guest/newGuestRole/index.tsx index f90eec506d381983823be674e8731c2bae1608ae..017cf9b514c35d6e46866af71dd53ee8a0d080cf 100644 --- a/frontend/src/routes/sponsor/guest/newGuestRole/index.tsx +++ b/frontend/src/routes/sponsor/guest/newGuestRole/index.tsx @@ -112,10 +112,8 @@ function NewGuestRole({ guest, reloadGuestInfo }: NewGuestRoleProps) { history.push(`/sponsor/guest/${pid}`) }) - const tempOus = useOus() - const ous = tempOus === undefined ? [] : tempOus - const tempRoleTypes = useRoleTypes() - const roleTypes = tempRoleTypes === undefined ? [] : tempRoleTypes + const ous = useOus() ?? [] + const roleTypes = useRoleTypes() ?? [] const [ouChoice, setOuChoice] = useState<string>('') const [roleTypeChoice, setRoleTypeChoice] = useState<string>('') const [t, i18n] = useTranslation('common') diff --git a/frontend/src/routes/sponsor/register/stepPersonForm.tsx b/frontend/src/routes/sponsor/register/stepPersonForm.tsx index ede38d42b947337c29ceb9c1bcd04bc6ecf1f923..fa1097cd6eaa042eb2c95ece38e4a29310cf02cc 100644 --- a/frontend/src/routes/sponsor/register/stepPersonForm.tsx +++ b/frontend/src/routes/sponsor/register/stepPersonForm.tsx @@ -35,9 +35,7 @@ const StepPersonForm = forwardRef( (props: StepPersonFormProperties, ref: Ref<PersonFormMethods>) => { const { i18n, t } = useTranslation(['common']) const { nextHandler, formData } = props - - const tempOus = useOus() - const ous = tempOus === undefined ? [] : tempOus + const ous = useOus() ?? [] const [ouChoice, setOuChoice] = useState( formData.ou_id ? formData.ou_id : '' @@ -47,8 +45,7 @@ const StepPersonForm = forwardRef( ) const today = new Date() const [todayPlusMaxDays, setTodayPlusMaxDays] = useState(today) - const tempRoleTypes = useRoleTypes() - const roleTypes = tempRoleTypes === undefined ? [] : tempRoleTypes + const roleTypes = useRoleTypes() ?? [] const { displayContactAtUnit, displayComment } = useContext(FeatureContext) const roleTypeSort = () => (a: RoleTypeData, b: RoleTypeData) => { diff --git a/frontend/src/routes/sponsor/register/stepSummary.tsx b/frontend/src/routes/sponsor/register/stepSummary.tsx index aa551a67ba079153b91f1b4232be265113c81725..775b088c3bdae9e10fe9fa74a83b38229aba6be5 100644 --- a/frontend/src/routes/sponsor/register/stepSummary.tsx +++ b/frontend/src/routes/sponsor/register/stepSummary.tsx @@ -23,10 +23,8 @@ interface StepSummaryProperties { function StepSummary(props: StepSummaryProperties) { const { t } = useTranslation(['common']) const { formData } = props - const tempOus = useOus() - const ous = tempOus === undefined ? [] : tempOus - const tempRoleTypes = useRoleTypes() - const roleTypes = tempRoleTypes === undefined ? [] : tempRoleTypes + const ous = useOus() ?? [] + const roleTypes = useRoleTypes() ?? [] const selectedOus = ous.find((value) => value.id === formData.ou_id) const ousName =