Skip to content

Commit

Permalink
fix: improve type safety and null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
thoreyjona committed Oct 15, 2024
1 parent 341f888 commit 7f9d311
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions apps/native/app/src/screens/health/health-overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,19 @@ export const HealthOverviewScreen: NavigationFunctionComponent = ({
})

const isOrganDonor =
organDonationRes.data?.healthDirectorateOrganDonation.donor?.isDonor
organDonationRes.data?.healthDirectorateOrganDonation.donor?.isDonor ??
false

const isOrganDonorWithLimitations =
isOrganDonor &&
organDonationRes.data?.healthDirectorateOrganDonation.donor?.limitations
?.hasLimitations
(organDonationRes.data?.healthDirectorateOrganDonation.donor?.limitations
?.hasLimitations ??
false)

const organLimitations = isOrganDonorWithLimitations
? organDonationRes.data?.healthDirectorateOrganDonation.donor?.limitations?.limitedOrgansList?.map(
(organ) => organ.name,
)
) ?? []
: []

useConnectivityIndicator({
Expand Down

0 comments on commit 7f9d311

Please sign in to comment.