Reputation: 1426
I have a function that set a value in the server and then depending of the result dispatch different actions.
actions.js file:
const fetchList = () => {
return dispatch => {
return api.list().then(list => {
dispatch(receiveList(list));
});
};
};
...
const changeItems = () => {
return dispatch => {
return api.change()
.then(() => {
fetchList()(dispatch);
})
.fail(() => {
messageService('Change Failed')(dispatch);
});
};
};
Am I doing something wrong or the fetchList()(dispatch)
is the right thing to do?
Upvotes: 0
Views: 35