How can I know when a redux-saga function has completed in the calling code -
react, redux, redux-saga
i dispatch action, create_requested
store. redux-saga runs, , makes async call server. after saga completes, i.e. blocks next create_requested
want execute additional code, container/component first create_requested
initiated.
// pseudo code class cmp extends react.component { oncreateclick(id) { const record = {id, name: 'alabala'} // missing .then() part this.props.dispatch({type: 'create_requested', record}).then(created => { console.log(created) } } }
is there way that? how? if not, how supposed design task?
one approach pass (resolve, reject) options along action, , make saga call them on succcess/failure. seems ok.
Comments
Post a Comment