diff --git a/src/components/BulkEditPane/BulkEditListResult/BulkEditInAppPreviewModal/BulkEditPreviewModal.js b/src/components/BulkEditPane/BulkEditListResult/BulkEditInAppPreviewModal/BulkEditPreviewModal.js index c571eee0..ef901a46 100644 --- a/src/components/BulkEditPane/BulkEditListResult/BulkEditInAppPreviewModal/BulkEditPreviewModal.js +++ b/src/components/BulkEditPane/BulkEditListResult/BulkEditInAppPreviewModal/BulkEditPreviewModal.js @@ -45,7 +45,7 @@ export const BulkEditPreviewModal = ({ id: bulkDetails?.id, approach: APPROACHES.IN_APP, step: EDITING_STEPS.COMMIT, - }); + }).then(showErrorMessage); onChangesCommited(); diff --git a/src/components/BulkEditPane/BulkEditListResult/BulkEditManualUploadModal/BulkEditManualUploadModal.js b/src/components/BulkEditPane/BulkEditListResult/BulkEditManualUploadModal/BulkEditManualUploadModal.js index 369dc632..fc2a9d7c 100644 --- a/src/components/BulkEditPane/BulkEditListResult/BulkEditManualUploadModal/BulkEditManualUploadModal.js +++ b/src/components/BulkEditPane/BulkEditListResult/BulkEditManualUploadModal/BulkEditManualUploadModal.js @@ -25,6 +25,7 @@ import { import { useBulkOperationDelete } from '../../../../hooks/api/useBulkOperationDelete'; import { ListFileUploader } from '../../../shared/ListFileUploader'; import { useSearchParams } from '../../../../hooks/useSearchParams'; +import { useErrorMessages } from '../../../../hooks/useErrorMessages'; const BulkEditManualUploadModal = ({ operationId, @@ -38,6 +39,7 @@ const BulkEditManualUploadModal = ({ const callout = useShowCallout(); const controller = useRef(null); const { identifier, criteria } = useSearchParams(); + const { showErrorMessage } = useErrorMessages(); const { fileUpload } = useUpload(); const { bulkOperationStart } = useBulkOperationStart(); @@ -102,7 +104,7 @@ const BulkEditManualUploadModal = ({ id: operationId, step: EDITING_STEPS.COMMIT, approach: APPROACHES.MANUAL, - }); + }).then(showErrorMessage); setCountOfRecords(committedNumOfRecords); diff --git a/src/components/BulkEditPane/BulkEditListSidebar/IdentifierTab/IdentifierTab.js b/src/components/BulkEditPane/BulkEditListSidebar/IdentifierTab/IdentifierTab.js index d63922fc..79108a45 100644 --- a/src/components/BulkEditPane/BulkEditListSidebar/IdentifierTab/IdentifierTab.js +++ b/src/components/BulkEditPane/BulkEditListSidebar/IdentifierTab/IdentifierTab.js @@ -157,7 +157,7 @@ export const IdentifierTab = () => { setIsFileUploaded(true); } catch (error) { - showErrorMessage(error, { fileName: fileToUpload.name }); + showErrorMessage({ errorMessage: error.message }, { fileName: fileToUpload.name }); } }; diff --git a/src/hooks/api/useBulkOperationStart.js b/src/hooks/api/useBulkOperationStart.js index a33e087f..f699c499 100644 --- a/src/hooks/api/useBulkOperationStart.js +++ b/src/hooks/api/useBulkOperationStart.js @@ -8,12 +8,10 @@ import { JOB_STATUSES, EDITING_STEPS, } from '../../constants'; -import { useErrorMessages } from '../useErrorMessages'; export const useBulkOperationStart = (mutationOptions = {}) => { const params = useRef({}); const ky = useOkapiKy(); - const { showErrorMessage } = useErrorMessages(); const { refetch: fetchBulkOperation } = useQuery({ queryFn: async () => { @@ -71,8 +69,6 @@ export const useBulkOperationStart = (mutationOptions = {}) => { return data; }, - onSuccess: showErrorMessage, - onError: showErrorMessage, ...mutationOptions, }); diff --git a/src/hooks/useConfirmChanges.js b/src/hooks/useConfirmChanges.js index 3f2642df..a989658b 100644 --- a/src/hooks/useConfirmChanges.js +++ b/src/hooks/useConfirmChanges.js @@ -65,9 +65,7 @@ export const useConfirmChanges = ({ approach: APPROACHES.IN_APP, step: EDITING_STEPS.EDIT, })) - .then((response) => { - showErrorMessage(response); - }) + .then(showErrorMessage) .catch((error) => { showErrorMessage(error); closePreviewModal();