Definitely do not redirect your gears, as they should be free from side effects. It looks like you are using api-redux-middleware, which, it seems to me, does not have a success / failure / completion callback, which I think will be a pretty useful feature for the library.
In this question from an intermediate repo, the repo owner offers something like this:
// Assuming you are using react-router version < 4.0 import { browserHistory } from 'react-router'; export function deleteItem(id) { return { [CALL_API]: { endpoint: `item/${id}`, method: 'DELETE', types: [ DELETE_ITEM_REQUEST, { type: DELETE_ITEM_SUCCESS, payload: (action, state, res) => { return res.json().then(json => { browserHistory.push('/your-route'); return json; }); }, }, DELETE_ITEM_FAILURE ] }, id } };
I personally prefer having a flag in my connected components, which, if true, will direct to the page I need. I would set componentWillReceiveProps as follows:
componentWillReceiveProps(nextProps) { if (nextProps.foo.isDeleted) { this.props.router.push('/your-route'); } }
source share