Skip to content

Commit

Permalink
Add nullsafe check to the beneficiary.person (#1181)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitur2204 authored Nov 24, 2022
1 parent 7faec83 commit f2268d7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/campaigns/CampaignDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default function CampaignDetails({ campaign }: Props) {
/>
<Typography variant="subtitle2" component="p" className={classes.beneficiaryName}>
{campaign.beneficiary.type === BeneficiaryType.individual
? campaign.beneficiary.person.firstName + ' ' + campaign.beneficiary.person?.lastName
? campaign.beneficiary.person?.firstName + ' ' + campaign.beneficiary.person?.lastName
: campaign.beneficiary.company.companyName}
</Typography>
</Grid>
Expand Down
4 changes: 2 additions & 2 deletions src/components/campaigns/grid/CampaignGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export const DisplayBeneficiary = ({ params }: CampaignCellProps) => {
return (
<>
{params.row.beneficiary.type === BeneficiaryType.individual
? params.row.beneficiary.person.firstName + ' ' + params.row.beneficiary.person?.lastName
: params.row.beneficiary.company.companyName}
? params.row.beneficiary.person?.firstName + ' ' + params.row.beneficiary?.person?.lastName
: params.row.beneficiary.company?.companyName}
</>
)
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/campaigns/grid/modals/DetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export default function DetailsModal({ campaign, onClose }: Props) {
<Typography variant="body1">Същество: {campaign.essence}</Typography>
<Typography variant="body1">Тип на кампанията: {campaign.campaignType.name}</Typography>
<Typography variant="body1">
Бенефициент: {campaign.beneficiary.person.firstName}{' '}
{campaign.beneficiary.person.lastName}
Бенефициент: {campaign.beneficiary.person?.firstName}{' '}
{campaign.beneficiary.person?.lastName}
</Typography>
<Typography variant="body1">
Координатор: {campaign.coordinator.person.firstName}{' '}
Expand Down
2 changes: 1 addition & 1 deletion src/components/one-time-donation/OneTimeDonationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default function OneTimeDonation({ slug }: { slug: string }) {
<Image
src={beneficiaryAvatarSource}
// A11Y TODO: Translate alt text
alt={`Image of ${campaign.beneficiary.person.firstName} ${campaign.beneficiary.person.lastName}`}
alt={`Image of ${campaign.beneficiary.person?.firstName} ${campaign.beneficiary.person?.lastName}`}
width={250}
height={250}
className={classes.beneficiaryAvatar}
Expand Down

0 comments on commit f2268d7

Please sign in to comment.