mirror of
https://github.com/immich-app/immich.git
synced 2025-12-18 09:13:15 +03:00
perf(web): asset delete (#7555)
* perf(web): asset delete * update asset delete on search page * don't use arrow function in class
This commit is contained in:
@@ -2,7 +2,7 @@ import { notificationController, NotificationType } from '$lib/components/shared
|
||||
import { deleteAssets as deleteBulk } from '@immich/sdk';
|
||||
import { handleError } from './handle-error';
|
||||
|
||||
export type OnDelete = (assetId: string) => void;
|
||||
export type OnDelete = (assetIds: string[]) => void;
|
||||
export type OnRestore = (ids: string[]) => void;
|
||||
export type OnArchive = (ids: string[], isArchived: boolean) => void;
|
||||
export type OnFavorite = (ids: string[], favorite: boolean) => void;
|
||||
@@ -11,9 +11,7 @@ export type OnStack = (ids: string[]) => void;
|
||||
export const deleteAssets = async (force: boolean, onAssetDelete: OnDelete, ids: string[]) => {
|
||||
try {
|
||||
await deleteBulk({ assetBulkDeleteDto: { ids, force } });
|
||||
for (const id of ids) {
|
||||
onAssetDelete(id);
|
||||
}
|
||||
onAssetDelete(ids);
|
||||
|
||||
notificationController.show({
|
||||
message: `${force ? 'Permanently deleted' : 'Trashed'} ${ids.length} assets`,
|
||||
|
||||
Reference in New Issue
Block a user