I have current scenario where I want to use function composition:
const funcTwo = (status, response) =>
(dispatch) => {
if (response.error) {
dispatch({ type: TOKEN_FAILURE });
dispatch(notificationShow('ERROR', response.error.message));
} else {
dispatch({ type: TOKEN_SUCCESS, payload: response.id });
}
};
export const funcOne = target =>
(dispatch) => {
dispatch({ type: TOKEN_REQUEST });
Helper.createToken(target, funcTwo);
};
I am currently facing an issue of dispatch not working in funcTwo due to it not being used in any sort of connect() but I wanted to know if it is possible to pass dispatch to it somehow?