diff --git a/frontend/src/components/object/DeleteObjectButton.vue b/frontend/src/components/object/DeleteObjectButton.vue index c7267a5b..4fbcc94b 100644 --- a/frontend/src/components/object/DeleteObjectButton.vue +++ b/frontend/src/components/object/DeleteObjectButton.vue @@ -41,14 +41,14 @@ const confirmDelete = () => { acceptLabel: 'Confirm', rejectLabel: 'Cancel', accept: async () => { - try { - 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`); - emit('on-deleted-error'); + for( const id of props.ids){ + try { + await objectStore.deleteObjects([id], props.versionId); + emit('on-deleted-success', props.versionId); + } + catch{ + // intentionally left blank + } } } }); diff --git a/frontend/src/components/object/ObjectFileDetails.vue b/frontend/src/components/object/ObjectFileDetails.vue index 3166e863..25c3ed95 100644 --- a/frontend/src/components/object/ObjectFileDetails.vue +++ b/frontend/src/components/object/ObjectFileDetails.vue @@ -15,7 +15,7 @@ import { ObjectVersion } from '@/components/object'; import { ShareObjectButton } from '@/components/object/share'; -import { Button, Dialog, Divider, useToast } from '@/lib/primevue'; +import { Button, Dialog, Divider } from '@/lib/primevue'; import { useAuthStore, useMetadataStore, @@ -60,7 +60,6 @@ const version: Ref = ref(undefined); // Actions const router = useRouter(); -const toast = useToast(); const showPermissions = async (objectId: string) => { permissionsVisible.value = true; @@ -69,8 +68,6 @@ const showPermissions = async (objectId: string) => { }; async function onDeletedSuccess(versionId: string) { - toast.success('File deleted'); - await Promise.all([ objectStore.fetchObjects({objectId: props.objectId, userId: getUserId.value, bucketPerms: true}), versionStore.fetchVersions({ objectId: props.objectId }) diff --git a/frontend/src/components/object/ObjectList.vue b/frontend/src/components/object/ObjectList.vue index ee1f91cf..340454a4 100644 --- a/frontend/src/components/object/ObjectList.vue +++ b/frontend/src/components/object/ObjectList.vue @@ -9,7 +9,7 @@ import { ObjectTable, ObjectUpload } from '@/components/object'; -import { Button, useToast } from '@/lib/primevue'; +import { Button } from '@/lib/primevue'; import { useAuthStore, useBucketStore, @@ -47,9 +47,6 @@ const selectedObjectIds = computed(() => { return getSelectedObjects.value.map((o) => o.id); }); -// Actions -const toast = useToast(); - const showObjectInfo = async (objectId: string | undefined) => { objectInfoId.value = objectId; }; @@ -75,10 +72,6 @@ const closeUpload = () => { // } // }; -function onDeletedSuccess() { - toast.success('File deleted'); -} - onMounted(async () => { // Removed for now // updateBreadcrumb(); @@ -122,7 +115,6 @@ onMounted(async () => { :disabled="displayUpload" :ids="selectedObjectIds" :mode="ButtonMode.BUTTON" - @on-deleted-success="onDeletedSuccess" /> diff --git a/frontend/src/components/object/ObjectVersion.vue b/frontend/src/components/object/ObjectVersion.vue index 527805f3..c3d790f5 100644 --- a/frontend/src/components/object/ObjectVersion.vue +++ b/frontend/src/components/object/ObjectVersion.vue @@ -7,7 +7,7 @@ import { DeleteObjectButton, DownloadObjectButton } from '@/components/object'; -import { Button, Column, DataTable, useToast } from '@/lib/primevue'; +import { Button, Column, DataTable } from '@/lib/primevue'; import { useAppStore, useAuthStore, usePermissionStore, useUserStore, useVersionStore } from '@/store'; import { Permissions, RouteNames } from '@/utils/constants'; import { ButtonMode } from '@/utils/enums'; @@ -42,13 +42,11 @@ const tableData: Ref> = ref([]); // Actions const router = useRouter(); -const toast = useToast(); // Highlight row for currently selected version const rowClass = (data: any) => [{ 'selected-row': data.id === props.versionId }]; async function onDeletedSuccess(versionId: string) { - toast.success('File deleted'); await versionStore.fetchVersions({ objectId: props.objectId }); // Navigate to new latest version if deleting active version diff --git a/frontend/src/store/objectStore.ts b/frontend/src/store/objectStore.ts index 727a63d0..79298a49 100644 --- a/frontend/src/store/objectStore.ts +++ b/frontend/src/store/objectStore.ts @@ -81,14 +81,12 @@ export const useObjectStore = defineStore('object', () => { try { appStore.beginIndeterminateLoading(); - return await Promise.all( - objectIds.map(async (id) => { - await objectService.deleteObject(id, versionId); - }) - ); + await objectService.deleteObject(objectIds[0], versionId); + toast.success('Object deleted'); } catch (error: any) { - toast.error('Deleting object', error); + toast.error('deleting object.'); + throw error; } finally { fetchObjects({ bucketId: bucketId, userId: getUserId.value, bucketPerms: true });