I have an issue with chaining the promises which have parameters assigned to them:
here is my initial chain :
dispatchTermsCondition(history, dispatch)
.then((history, dispatch)=>
dispatchSetPrivacy(history, dispatch)
)
.then(()=>
dispatcherUserTermsPrivacy(history,dispatch, getState,response.data.tj_id)
);
The first chain works fine and when it comes to second it cannot find the parameters I sent to it. Here is my second function(dispatchSetPrivacy):
export function dispatchSetPrivacy(history, dispatch) {
return axios.get("some url")
.then((response) => {
dispatch({
type: SET_PRIVACY,
payload: {
privacy: {id: response.data.id, content: response.data.content, version: response.data.version }
}
});
}).catch(function(response){
console.log(response);
history.push("/error");
});
}
Here is the error I get:
TypeError: dispatch is not a function at bundle.js:76071
and it happens in dispatchSetPrivacy.
Any idea?