Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
alten-dturus committed Dec 12, 2024
1 parent 1d36eeb commit 026dec6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const DelegationGeneralInfoSection: React.FC<DelegationGeneralInfoSection
.with(delegation.delegator.id, () => false)
.otherwise(() => false)

const lastDescriptor = getLastDescriptor(delegation.eservice.descriptors)
const lastDescriptor = getLastDescriptor(delegation.eservice?.descriptors)

const downloadDelegationContract = DelegationDownloads.useDownloadDelegationContract()

Expand Down Expand Up @@ -101,11 +101,11 @@ export const DelegationGeneralInfoSection: React.FC<DelegationGeneralInfoSection
<Link
to="PROVIDE_ESERVICE_SUMMARY"
params={{
eserviceId: delegation.eservice.id,
eserviceId: delegation.eservice?.id as string,
descriptorId: lastDescriptor.id,
}}
>
{delegation.eservice.name}
{delegation.eservice?.name}
</Link>
)
)
Expand All @@ -115,11 +115,11 @@ export const DelegationGeneralInfoSection: React.FC<DelegationGeneralInfoSection
<Link
to="PROVIDE_ESERVICE_MANAGE"
params={{
eserviceId: delegation.eservice.id,
eserviceId: delegation.eservice?.id as string,
descriptorId: lastDescriptor.id,
}}
>
{delegation.eservice.name}
{delegation.eservice?.name}
</Link>
)
)
Expand All @@ -132,19 +132,19 @@ export const DelegationGeneralInfoSection: React.FC<DelegationGeneralInfoSection
<Link
to="SUBSCRIBE_CATALOG_VIEW"
params={{
eserviceId: delegation.eservice.id,
eserviceId: delegation.eservice?.id as string,
descriptorId: lastDescriptor.id,
}}
>
{delegation.eservice.name}
{delegation.eservice?.name}
</Link>
)
)
.otherwise(() => delegation.eservice.name)}
.otherwise(() => delegation.eservice?.name ?? '-')}
/>
<InformationContainer
label={t('eserviceProducerField.label')}
content={delegation.eservice.producerName}
content={delegation.eservice?.producerName ?? '-'}
/>
<InformationContainer
label={t('delegationKindField.label')}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/eservice.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export function getDownloadDocumentName(document: EServiceDoc | Document) {
return `${document.prettyName}.${fileExtension}`
}

export function getLastDescriptor(descriptors: Array<CompactDescriptor>) {
const descriptor = descriptors.find((descriptor) =>
export function getLastDescriptor(descriptors: Array<CompactDescriptor> | undefined) {
const descriptor = descriptors?.find((descriptor) =>
descriptors.every((d) => descriptor.version >= d.version)
)
return descriptor
Expand Down

0 comments on commit 026dec6

Please sign in to comment.