make sure claim exists before showing download link
This commit is contained in:
parent
90bcfaa865
commit
4bb4d66852
1 changed files with 5 additions and 4 deletions
|
@ -35,8 +35,13 @@ function FileDownloadLink(props: Props) {
|
|||
costInfo,
|
||||
hideOpenButton = false,
|
||||
} = props;
|
||||
|
||||
const cost = costInfo ? Number(costInfo.cost) : 0;
|
||||
const isPaidContent = cost > 0;
|
||||
if (!claim || (IS_WEB && isPaidContent)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { name, claim_id: claimId, value } = claim;
|
||||
const fileName = value && value.source && value.source.name;
|
||||
const downloadUrl = `/$/download/${name}/${claimId}`;
|
||||
|
@ -52,10 +57,6 @@ function FileDownloadLink(props: Props) {
|
|||
// @endif;
|
||||
}
|
||||
|
||||
if (IS_WEB && isPaidContent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (downloading || loading) {
|
||||
const progress = fileInfo && fileInfo.written_bytes > 0 ? (fileInfo.written_bytes / fileInfo.total_bytes) * 100 : 0;
|
||||
const label =
|
||||
|
|
Loading…
Reference in a new issue