Skip to content

Commit

Permalink
The user is redirected to the right download page after clicking on `…
Browse files Browse the repository at this point in the history
…Download file` button.
  • Loading branch information
milanmajchrak committed Oct 30, 2023
1 parent 342eb63 commit e7ba37a
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Input } from '@angular/core';
import { MetadataBitstream } from 'src/app/core/metadata/metadata-bitstream.model';
import { HALEndpointService } from '../../../../../core/shared/hal-endpoint.service';
import {Router} from '@angular/router';

const allowedPreviewFormats = ['text/plain', 'text/html', 'application/zip'];
@Component({
Expand All @@ -12,11 +13,20 @@ export class FileDescriptionComponent {
@Input()
fileInput: MetadataBitstream;

constructor(protected halService: HALEndpointService) { }
constructor(protected halService: HALEndpointService, private router: Router) { }

public downloadFiles() {
console.log('${this.fileInput.href}', `${this.fileInput.href}`);
window.location.href = this.halService.getRootHref().replace('/server/api', '') + `${this.fileInput.href}`;
console.log('gile', this.fileInput);
// console.log('this.halService.getRootHref()', );
// const href$ = this.halService.getEndpoint('bitstreams');
this.router.navigateByUrl('bitstreams/' + this.fileInput.id + '/download');
// href$.pipe(
// find((href: string) => hasValue(href)),
// ).subscribe((endpoint: string) => {
// console.log('endpoint', endpoint + '/' + this.fileInput.id + '/download');
// });
// window.location.href = this.halService.getRootHref()
}

public isTxt() {
Expand Down

0 comments on commit e7ba37a

Please sign in to comment.