fix(web): album download progress bar (#925)

This commit is contained in:
Jason Rasmussen 2022-11-04 12:45:17 -04:00 committed by GitHub
parent 0d7ccc2b26
commit 86e50f97ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 2 deletions

View file

@ -322,8 +322,20 @@
$downloadAssets[fileName] = 0;
let total = 0;
const { data, status } = await api.albumApi.downloadArchive(album.id, {
responseType: 'blob'
responseType: 'blob',
onDownloadProgress: function (progressEvent) {
const request = this as XMLHttpRequest;
if (!total) {
total = Number(request.getResponseHeader('X-Immich-Content-Length-Hint')) || 0;
}
if (total) {
const current = progressEvent.loaded;
$downloadAssets[fileName] = Math.floor((current / total) * 100);
}
}
});
if (!(data instanceof Blob)) {