redux saga - yield on a function that returns object which includes a promise -
in saga have function need yield on doesnt return promise directly. function this:
export function requestdownload(url): { let resolve, reject; return { type: request, url, promise: new promise(res=>resolve=res, rej=>reject=rej), resolve, reject } }
i need yield
on promise
field in return. tried variations of call
not able this. cannot modify requestdownload
function return promise directly.
is possible of redux-saga helpers?
in summary trying do:
i trying do:
function* mysaga() { yield call(requestdownload, 'blah_url') }
how about:
function* mysaga() { let action = yield call(requestdownload, 'blah_url') try { let data = yield action.promise } catch(err) { // deal error } }
Comments
Post a Comment