Skip to content
Snippets Groups Projects
Commit 9244787b authored by Tore.Brede's avatar Tore.Brede
Browse files

GREG-160: Using nullish coalescing operator

parent 51655a85
No related branches found
No related tags found
1 merge request!252GREG-160: Error temporarily showing
......@@ -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')
......
......@@ -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) => {
......
......@@ -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 =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment