|
|
|
@ -1,4 +1,7 @@
|
|
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
|
|
import { Router, ActivatedRoute } from '@angular/router';
|
|
|
|
|
import {HttpClient} from '@angular/common/http';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-download-link',
|
|
|
|
@ -6,8 +9,30 @@ import { Component, OnInit } from '@angular/core';
|
|
|
|
|
styleUrls: ['./download-link.component.scss']
|
|
|
|
|
})
|
|
|
|
|
export class DownloadLinkComponent implements OnInit {
|
|
|
|
|
idFile: String;
|
|
|
|
|
urlFile: String;
|
|
|
|
|
file: any;
|
|
|
|
|
|
|
|
|
|
constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute) {
|
|
|
|
|
this.idFile = '';
|
|
|
|
|
this.urlFile = '';
|
|
|
|
|
this.route.params.subscribe(params => {
|
|
|
|
|
this.idFile = params['id'];
|
|
|
|
|
this.urlFile = 'http://localhost:3000/' + this.idFile;
|
|
|
|
|
console.log('this.idFile : ' + this.idFile );
|
|
|
|
|
|
|
|
|
|
this.http.post('/api/getFileById', {id: this.idFile.toString()}).subscribe(file => {
|
|
|
|
|
|
|
|
|
|
constructor() { }
|
|
|
|
|
if (file) {
|
|
|
|
|
this.file = file[0];
|
|
|
|
|
console.log(this.file)
|
|
|
|
|
} else {
|
|
|
|
|
this.file = [];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
}
|
|
|
|
|