improve web

This commit is contained in:
Jonathan Jogenfors 2024-01-26 14:24:12 +01:00
parent 95adc02fcb
commit a9d0be43f5
2 changed files with 5 additions and 7 deletions

View File

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

View File

@ -83,10 +83,9 @@ async function fileUploader(asset: File, albumId: string | undefined = undefined
key: api.getKey(), key: api.getKey(),
}, },
{ {
onUploadProgress: ({ loaded, total }) => { onUploadProgress: ({ event }) => {
if (total) { const { loaded, total } = event;
uploadAssetsStore.updateProgress(deviceAssetId, loaded, total); uploadAssetsStore.updateProgress(deviceAssetId, loaded, total);
}
}, },
}, },
), ),