removed multiple invocations of notification.

Added count to final notification which appears at the end of upload process.
This commit is contained in:
Art051
2024-05-12 16:07:13 +01:00
parent f667c9597b
commit 6a827149d5
2 changed files with 2 additions and 17 deletions

View File

@@ -41,7 +41,7 @@
});
} else if ($successCounter > 0) {
notificationController.show({
message: 'Upload success, refresh the page to see new upload assets.',
message: `Uploaded ${$successCounter} assets successfully, refresh the page to see new upload assets.`,
type: NotificationType.Info,
});
}

View File

@@ -25,28 +25,13 @@ import { get } from 'svelte/store';
import { handleError } from './handle-error';
export const addAssetsToAlbum = async (albumId: string, assetIds: string[]) => {
const result = await addAssets({
await addAssets({
id: albumId,
bulkIdsDto: {
ids: assetIds,
},
key: getKey(),
});
const count = result.filter(({ success }) => success).length;
notificationController.show({
type: NotificationType.Info,
timeout: 5000,
message:
count > 0
? `Added ${count} asset${count === 1 ? '' : 's'} to the album`
: `Asset${assetIds.length === 1 ? ' was' : 's were'} already part of the album`,
button: {
text: 'View Album',
onClick() {
return goto(`${AppRoute.ALBUMS}/${albumId}`);
},
},
});
};
export const addAssetsToNewAlbum = async (albumName: string, assetIds: string[]) => {