Use named arguments with download file

This commit is contained in:
Tiger Oakes
2020-09-26 14:50:10 -07:00
parent 1112548246
commit d1311d00ea
8 changed files with 42 additions and 20 deletions

View File

@@ -71,7 +71,7 @@ export class CustomPlaylistsComponent implements OnInit {
}
downloadPlaylist(fileNames, type, zipName = null, playlistID = null) {
this.postsService.downloadFileFromServer(fileNames, type, zipName).subscribe(res => {
this.postsService.downloadFileFromServer(fileNames, type, {outputName: zipName}).subscribe(res => {
if (playlistID) { this.downloading_content[type][playlistID] = false };
const blob: Blob = res;
saveAs(blob, zipName + '.zip');

View File

@@ -190,13 +190,15 @@ export class RecentVideosComponent implements OnInit {
const type = (file.isAudio ? 'audio' : 'video') as FileType;
const ext = type === 'audio' ? '.mp3' : '.mp4'
const sub = this.postsService.getSubscriptionByID(file.sub_id);
this.postsService.downloadFileFromServer(file.id, type, null, null, sub.name, sub.isPlaylist,
this.postsService.user ? this.postsService.user.uid : null, null).subscribe(res => {
const blob: Blob = res;
saveAs(blob, file.id + ext);
}, err => {
console.log(err);
});
this.postsService.downloadFileFromServer(
file.id, type,
{subscriptionName: sub.name, subPlaylist: sub.isPlaylist, uid: this.postsService.user ? this.postsService.user.uid : null}
).subscribe(res => {
const blob: Blob = res;
saveAs(blob, file.id + ext);
}, err => {
console.log(err);
});
}
downloadNormalFile(file) {