mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
refactor: add to album (#26366)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<script lang="ts">
|
||||
import AlbumPickerModal from '$lib/modals/AlbumPickerModal.svelte';
|
||||
import { addAssetsToAlbums } from '$lib/services/album.service';
|
||||
import { type AlbumResponseDto } from '@immich/sdk';
|
||||
|
||||
type Props = {
|
||||
assetIds: string[];
|
||||
onClose: () => void;
|
||||
};
|
||||
|
||||
const { assetIds, onClose }: Props = $props();
|
||||
|
||||
const handleClose = async (albums?: AlbumResponseDto[]) => {
|
||||
const albumIds = (albums ?? []).map(({ id }) => id);
|
||||
if (albumIds.length === 0) {
|
||||
onClose();
|
||||
return;
|
||||
}
|
||||
|
||||
const success = await addAssetsToAlbums(albumIds, assetIds, { notify: true });
|
||||
if (success) {
|
||||
onClose();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<AlbumPickerModal onClose={handleClose} />
|
||||
Reference in New Issue
Block a user