React, redux, redux-saga
I dispatch an action, say CREATE_REQUESTED
to the store.
Redux-saga runs, and makes the async call to the server.
After the saga completes, i.e. blocks for the next CREATE_REQUESTED
I want to execute additional code, from the container/component from which the first CREATE_REQUESTED
was initiated.
// pseudo code
class Cmp extends React.component {
onCreateClick(id) {
const record = {id, name: 'alabala'}
// I am missing the .then() part
this.props.dispatch({type: 'CREATE_REQUESTED', record}).then(created => {
console.log(created)
}
}
}
Is there a way to do that? How? If not, how am I supposed to design this task?