mirror of
https://github.com/immich-app/immich.git
synced 2026-03-26 20:00:44 +03:00
chore(web): refactor replace asset (#23972)
This commit is contained in:
11
web/src/lib/services/asset.service.ts
Normal file
11
web/src/lib/services/asset.service.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { eventManager } from '$lib/managers/event-manager.svelte';
|
||||
import { openFileUploadDialog } from '$lib/utils/file-uploader';
|
||||
import { copyAsset, deleteAssets } from '@immich/sdk';
|
||||
|
||||
export const handleReplaceAsset = async (oldAssetId: string) => {
|
||||
const [newAssetId] = await openFileUploadDialog({ multiple: false });
|
||||
await copyAsset({ assetCopyDto: { sourceId: oldAssetId, targetId: newAssetId } });
|
||||
await deleteAssets({ assetBulkDeleteDto: { ids: [oldAssetId], force: true } });
|
||||
|
||||
eventManager.emit('AssetReplace', { oldAssetId, newAssetId });
|
||||
};
|
||||
Reference in New Issue
Block a user