diff --git a/frontend/src/components/object/DeleteObjectButton.vue b/frontend/src/components/object/DeleteObjectButton.vue index 710b4edd..c7267a5b 100644 --- a/frontend/src/components/object/DeleteObjectButton.vue +++ b/frontend/src/components/object/DeleteObjectButton.vue @@ -37,19 +37,14 @@ const confirmDelete = () => { const msgContext = props.ids.length > 1 ? `the selected ${props.ids.length} ${item}s` : `this ${item}`; confirm.require({ message: `Please confirm that you want to delete ${msgContext}.`, - header: `Delete ${props.ids.length > 1 ? item + 's' : item }`, + header: `Delete ${props.ids.length > 1 ? item + 's' : item}`, acceptLabel: 'Confirm', rejectLabel: 'Cancel', accept: async () => { try { - const res = await objectStore.deleteObjects(props.ids, props.versionId); - res?.forEach((ele, index)=>{ - if (ele.status === 'fulfilled') { - emit('on-deleted-success', props.ids[index]); - } else { - toast.error(`Error deleting ${props.ids[index]}`); - emit('on-deleted-error'); - } + props.ids?.forEach(async (ele) => { + const res = await objectStore.deleteObjects([ele], props.versionId); + if (res) emit('on-deleted-success', props.versionId); }); } catch (error: any) { toast.error(`Error deleting one or more ${item}s`); @@ -64,38 +59,18 @@ const confirmDelete = () => { diff --git a/frontend/src/store/objectStore.ts b/frontend/src/store/objectStore.ts index e1642072..727a63d0 100644 --- a/frontend/src/store/objectStore.ts +++ b/frontend/src/store/objectStore.ts @@ -81,9 +81,7 @@ export const useObjectStore = defineStore('object', () => { try { appStore.beginIndeterminateLoading(); - // Promise.allSettled returns array with an object per promise - // check MDN for details - return await Promise.allSettled( + return await Promise.all( objectIds.map(async (id) => { await objectService.deleteObject(id, versionId); })