ngex/effects - , .

, , "" , - . effecs, , , .
, ? , , - . , , , . , , . - :
@Effect() start$ = this.actions$
.ofType('START')
.map(toPayload)
.switchMap(input => doAsyncTask(input)
.map(result =>{
this.store$.dispatch(
{type: 'SUCCESS',
payload: result
});
this.store$.dispatch(
{type: 'ADVANCE'})
}
.catch(error => ({type: 'ERROR', payload: error})));
Do you see what I'm doing here? I removed an intermediate product that intercepts "success", so not "success" gets into the gearbox. Immediately after that, it sends another action of the type “forward”, which should hit your facility after the “success” is processed.
Hope this helps.
source
share