Skip to content

Commit

Permalink
UIIN-2452: Fixes in CreateHoldings component
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksandrHladchenko1 committed Oct 24, 2023
1 parent fd7e0ce commit 1523490
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Holding/CreateHolding/CreateHolding.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const CreateHolding = ({
const callout = useCallout();
const { instance, isLoading: isInstanceLoading } = useInstance(instanceId);
const sourceId = referenceData.holdingsSourcesByName?.FOLIO?.id;
const { location: { state: { tenantFrom } } } = history;
const tenantFrom = location?.state?.tenantFrom || stripes.okapi.tenant;

const goBack = useCallback(() => {
history.push({
Expand All @@ -45,15 +45,16 @@ const CreateHolding = ({

const onSubmit = useCallback((newHolding) => {
return mutator.holding.POST(newHolding)
.then((holdingsRecord) => {
.then(async (holdingsRecord) => {
await onCancel();

callout.sendCallout({
type: 'success',
message: <FormattedMessage
id="ui-inventory.holdingsRecord.successfullySaved"
values={{ hrid: holdingsRecord.hrid }}
/>,
});
onCancel();
});
}, [onCancel, callout]);

Expand Down

0 comments on commit 1523490

Please sign in to comment.