Skip to content

Commit

Permalink
update confirm handler based on BE requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
vashjs committed Jan 10, 2025
1 parent a93761c commit 8a6c8e3
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/components/BulkEditPane/BulkEditMarcLayer/BulkEditMarcLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,30 @@ export const BulkEditMarcLayer = ({
...getTransformedField(field),
}));

const marcUpdateBody = {
const marcDefaultBody = {
bulkOperationMarcRules: [],
totalRecords: 0,
};

const administrativeDefaultBody = {
bulkOperationRules: [],
totalRecords: 0,
};

const marcUpdateBody = isMarcFieldsValid ? {
bulkOperationMarcRules,
totalRecords,
};
} : marcDefaultBody;

const administrativeBody = getContentUpdatesBody({
const administrativeBody = isAdministrativeFormValid ? getContentUpdatesBody({
bulkOperationId,
contentUpdates,
totalRecords,
});
}) : administrativeDefaultBody;

// send updates only for valid forms
confirmChanges([
...(isMarcFieldsValid ? [marcContentUpdate(marcUpdateBody)] : []),
...(isAdministrativeFormValid ? [contentUpdate(administrativeBody)] : []),
contentUpdate(administrativeBody),
marcContentUpdate(marcUpdateBody),
]);
};

Expand Down

0 comments on commit 8a6c8e3

Please sign in to comment.