score:1

Accepted answer

per the redux-promise source code, it looks like it should return the chained promise:

return ispromise(action.payload)
  ? action.payload.then(
      result => dispatch({ ...action, payload: result }),
      error => {
        dispatch({ ...action, payload: error, error: true });
        return promise.reject(error);
      }
    )
  : next(action);

so, i would assume that you could chain off of the dispatch.

that said, your snippet has a couple potential issues. if that's in a component, then where is deletepost coming from? you're also not using this in front of setstate. assuming that deletepost is a bound-up action creator, this example should be correct:

ondeleteclick() {
    this.props.deletepost(id)
        .then(() => this.setstate({redirect : true});
}

Related Query

More Query from same tag