diff --git a/src/editors/data/redux/thunkActions/app.js b/src/editors/data/redux/thunkActions/app.js index 99c579567..da5acf2c3 100644 --- a/src/editors/data/redux/thunkActions/app.js +++ b/src/editors/data/redux/thunkActions/app.js @@ -70,7 +70,7 @@ export const saveBlock = ({ content, returnToUnit }) => (dispatch) => { content, onSuccess: (response) => { dispatch(actions.app.setSaveResponse(response)); - returnToUnit(); + returnToUnit(response.data)(); }, })); }; diff --git a/src/editors/data/redux/thunkActions/app.test.js b/src/editors/data/redux/thunkActions/app.test.js index bb8457c6a..5710071f9 100644 --- a/src/editors/data/redux/thunkActions/app.test.js +++ b/src/editors/data/redux/thunkActions/app.test.js @@ -138,7 +138,7 @@ describe('app thunkActions', () => { let returnToUnit; let calls; beforeEach(() => { - returnToUnit = jest.fn(); + returnToUnit = jest.fn((response) => () => response); thunkActions.saveBlock({ content: testValue, returnToUnit })(dispatch); calls = dispatch.mock.calls; }); diff --git a/src/editors/hooks.js b/src/editors/hooks.js index c9dc77665..8ce7147ce 100644 --- a/src/editors/hooks.js +++ b/src/editors/hooks.js @@ -21,12 +21,12 @@ export const navigateCallback = ({ destination, analyticsEvent, analytics, -}) => () => { +}) => (response) => { if (process.env.NODE_ENV !== 'development' && analyticsEvent && analytics) { sendTrackEvent(analyticsEvent, analytics); } if (returnFunction) { - returnFunction(); + returnFunction()(response); return; } module.navigateTo(destination); diff --git a/src/editors/hooks.test.jsx b/src/editors/hooks.test.jsx index 5fc21b04a..df1545827 100644 --- a/src/editors/hooks.test.jsx +++ b/src/editors/hooks.test.jsx @@ -74,7 +74,6 @@ describe('hooks', () => { let output; const SAVED_ENV = process.env; const destination = 'hOmE'; - const returnFunction = jest.fn(); beforeEach(() => { jest.resetModules(); process.env = { ...SAVED_ENV }; @@ -102,6 +101,7 @@ describe('hooks', () => { expect(spy).toHaveBeenCalledWith(destination); }); it('should call returnFunction and return null', () => { + const returnFunction = jest.fn(() => (response) => response); output = hooks.navigateCallback({ destination, returnFunction,