This commit is contained in:
Jonathan Jogenfors 2024-01-26 14:18:22 +01:00
parent 742599d1d1
commit 95adc02fcb
2 changed files with 6 additions and 3 deletions

View File

@ -11,6 +11,7 @@ import {
} from '@api';
import { handleError } from './handle-error';
import { DateTime } from 'luxon';
import type { AxiosProgressEvent } from 'axios';
export const addAssetsToAlbum = async (albumId: string, assetIds: Array<string>): Promise<BulkIdResponseDto[]> =>
api.albumApi
@ -125,8 +126,8 @@ export const downloadFile = async (asset: AssetResponseDto) => {
{ id, key: api.getKey() },
{
responseType: 'blob',
onDownloadProgress: (event: ProgressEvent) => {
if (event.lengthComputable) {
onDownloadProgress: (event: AxiosProgressEvent) => {
if (event.total !== undefined) {
downloadManager.update(downloadKey, event.loaded, event.total);
}
},

View File

@ -84,7 +84,9 @@ async function fileUploader(asset: File, albumId: string | undefined = undefined
},
{
onUploadProgress: ({ loaded, total }) => {
if (total) {
uploadAssetsStore.updateProgress(deviceAssetId, loaded, total);
}
},
},
),