diff --git a/src/app/datashare/download-link.service.ts b/src/app/datashare/download-link.service.ts index 559f64eef9f..df7644ca275 100644 --- a/src/app/datashare/download-link.service.ts +++ b/src/app/datashare/download-link.service.ts @@ -23,30 +23,17 @@ export class DownloadLinkService { } getDownloadLink(itemId: string): Observable { - console.log("itemId:", itemId); - console.log(`${environment.rest.baseUrl}/api/datashare/items/${itemId}/zip-file-link`); + // console.log("itemId:", itemId); + // console.log(`${environment.rest.baseUrl}/api/datashare/items/${itemId}/zip-file-link`); const options = { responseType: 'text' as const, }; return this.httpClient.get(`${environment.rest.baseUrl}/api/datashare/items/${itemId}/zip-file-link`, options).pipe( map((response: string) => { - console.log('response:', response); + // console.log('response:', response); return response; }) ); } - isDownloadLinkAvailable(itemId: string): Observable { - console.log("itemId:", itemId); - console.log(`${environment.rest.baseUrl}/api/datashare/items/${itemId}/zip-file-link`); - const options = { - responseType: 'text' as const, - }; - return this.httpClient.get(`${environment.rest.baseUrl}/api/datashare/items/${itemId}/zip-file-downloadable`, options).pipe( - map((response: string) => { - console.log('response:', response); - return Boolean(response); - }) - ); - } } diff --git a/src/themes/datashare/app/item-page/simple/field-components/file-section/file-section.component.html b/src/themes/datashare/app/item-page/simple/field-components/file-section/file-section.component.html index b7d39977e7b..c45c2a6843e 100644 --- a/src/themes/datashare/app/item-page/simple/field-components/file-section/file-section.component.html +++ b/src/themes/datashare/app/item-page/simple/field-components/file-section/file-section.component.html @@ -1,9 +1,10 @@
- + + {{downloadLink}}

diff --git a/src/themes/datashare/app/item-page/simple/field-components/file-section/file-section.component.ts b/src/themes/datashare/app/item-page/simple/field-components/file-section/file-section.component.ts index 2510266db27..dea761f3d20 100644 --- a/src/themes/datashare/app/item-page/simple/field-components/file-section/file-section.component.ts +++ b/src/themes/datashare/app/item-page/simple/field-components/file-section/file-section.component.ts @@ -116,13 +116,9 @@ export class FileSectionComponent extends BaseComponent { ); this.downloadLink$ = this.downloadLinkService.getDownloadLink(this.item.id).pipe( - filter(response => !!response && response.length > 0), - map(response => response) + filter(link => hasValue(link) && link.length > 0), + map(link => link) ); - this.downloadLinkAvailable$ = this.downloadLinkService.isDownloadLinkAvailable(this.item.id).pipe( - filter((response: boolean) => !!response && response), - map(response => response) - ); }