added the error handling

This commit is contained in:
Notoriousbrain 2025-07-24 03:28:35 +05:30
parent 8be8f0a5a5
commit 9e711c1e09
1 changed files with 9 additions and 3 deletions

View File

@ -98,9 +98,15 @@ export function MediaView() {
setDialogOpen(false);
return;
}
await removeMediaItem(activeProject.id, itemToRemove.id);
setDialogOpen(false);
setItemToRemove(null);
try {
await removeMediaItem(activeProject.id, itemToRemove.id);
} catch (error) {
console.error("Failed to remove media item:", error);
toast.error("Failed to delete media item");
} finally {
setDialogOpen(false);
setItemToRemove(null);
}
};
const formatDuration = (duration: number) => {