对redux-observables,rxjs和observables来说相当新.我想知道如何处理另一个动作,在同一个史诗中说'ActionTwo'
const Epic1 = (action$,store) => {
return action$.ofType('ActionOne')
.mergeMap((action) => {
return ajax({'method': 'GET', 'url': 'someUrl')
.map(response => resultActoin(action.userId, response.response));
}
);
}
Run Code Online (Sandbox Code Playgroud)
就像是
const Epic1 = (action$){
if('ActionOne') make a API call.
if('ActionTwo') make some other API call.
else do nothing.
}
Run Code Online (Sandbox Code Playgroud)