From 1523490ddb18b894b78bb91022e94d17e8404ff2 Mon Sep 17 00:00:00 2001 From: Oleksandr Hladchenko1 Date: Tue, 24 Oct 2023 15:00:45 +0300 Subject: [PATCH] UIIN-2452: Fixes in CreateHoldings component --- src/Holding/CreateHolding/CreateHolding.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Holding/CreateHolding/CreateHolding.js b/src/Holding/CreateHolding/CreateHolding.js index f097e4ded..d778690ee 100644 --- a/src/Holding/CreateHolding/CreateHolding.js +++ b/src/Holding/CreateHolding/CreateHolding.js @@ -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({ @@ -45,7 +45,9 @@ const CreateHolding = ({ const onSubmit = useCallback((newHolding) => { return mutator.holding.POST(newHolding) - .then((holdingsRecord) => { + .then(async (holdingsRecord) => { + await onCancel(); + callout.sendCallout({ type: 'success', message: , }); - onCancel(); }); }, [onCancel, callout]);