|
|
|
@ -28,7 +28,7 @@ import { t } from 'svelte-i18n';
|
|
|
|
import { get } from 'svelte/store';
|
|
|
|
import { get } from 'svelte/store';
|
|
|
|
import { handleError } from './handle-error';
|
|
|
|
import { handleError } from './handle-error';
|
|
|
|
|
|
|
|
|
|
|
|
export const addAssetsToAlbum = async (albumId: string, assetIds: string[]) => {
|
|
|
|
export const addAssetsToAlbum = async (albumId: string, assetIds: string[], showNotification = true) => {
|
|
|
|
const result = await addAssets({
|
|
|
|
const result = await addAssets({
|
|
|
|
id: albumId,
|
|
|
|
id: albumId,
|
|
|
|
bulkIdsDto: {
|
|
|
|
bulkIdsDto: {
|
|
|
|
@ -38,20 +38,23 @@ export const addAssetsToAlbum = async (albumId: string, assetIds: string[]) => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
const count = result.filter(({ success }) => success).length;
|
|
|
|
const count = result.filter(({ success }) => success).length;
|
|
|
|
const $t = get(t);
|
|
|
|
const $t = get(t);
|
|
|
|
notificationController.show({
|
|
|
|
|
|
|
|
type: NotificationType.Info,
|
|
|
|
if (showNotification) {
|
|
|
|
timeout: 5000,
|
|
|
|
notificationController.show({
|
|
|
|
message:
|
|
|
|
type: NotificationType.Info,
|
|
|
|
count > 0
|
|
|
|
timeout: 5000,
|
|
|
|
? $t('assets_added_to_album_count', { values: { count: count } })
|
|
|
|
message:
|
|
|
|
: $t('assets_were_part_of_album_count', { values: { count: assetIds.length } }),
|
|
|
|
count > 0
|
|
|
|
button: {
|
|
|
|
? $t('assets_added_to_album_count', { values: { count: count } })
|
|
|
|
text: $t('view_album'),
|
|
|
|
: $t('assets_were_part_of_album_count', { values: { count: assetIds.length } }),
|
|
|
|
onClick() {
|
|
|
|
button: {
|
|
|
|
return goto(`${AppRoute.ALBUMS}/${albumId}`);
|
|
|
|
text: $t('view_album'),
|
|
|
|
|
|
|
|
onClick() {
|
|
|
|
|
|
|
|
return goto(`${AppRoute.ALBUMS}/${albumId}`);
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const addAssetsToNewAlbum = async (albumName: string, assetIds: string[]) => {
|
|
|
|
export const addAssetsToNewAlbum = async (albumName: string, assetIds: string[]) => {
|
|
|
|
|