diff --git a/web/src/lib/utils/asset-utils.ts b/web/src/lib/utils/asset-utils.ts index 2b95f3f8ca..9f67059dfd 100644 --- a/web/src/lib/utils/asset-utils.ts +++ b/web/src/lib/utils/asset-utils.ts @@ -11,7 +11,6 @@ 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): Promise => api.albumApi @@ -126,8 +125,8 @@ export const downloadFile = async (asset: AssetResponseDto) => { { id, key: api.getKey() }, { responseType: 'blob', - onDownloadProgress: (event: AxiosProgressEvent) => { - if (event.total !== undefined) { + onDownloadProgress: ({ event }) => { + if (event.lengthComputable) { downloadManager.update(downloadKey, event.loaded, event.total); } }, diff --git a/web/src/lib/utils/file-uploader.ts b/web/src/lib/utils/file-uploader.ts index e915d7991f..5e47b156f0 100644 --- a/web/src/lib/utils/file-uploader.ts +++ b/web/src/lib/utils/file-uploader.ts @@ -83,10 +83,9 @@ async function fileUploader(asset: File, albumId: string | undefined = undefined key: api.getKey(), }, { - onUploadProgress: ({ loaded, total }) => { - if (total) { - uploadAssetsStore.updateProgress(deviceAssetId, loaded, total); - } + onUploadProgress: ({ event }) => { + const { loaded, total } = event; + uploadAssetsStore.updateProgress(deviceAssetId, loaded, total); }, }, ),