我从一个效果返回多个动作, concatMap 按顺序发送动作,但不要等待完成发送下一个动作。loadDetails 在收到 loadDetailsSuccess 时调用 REST 服务并更新存储
我想在调用 HttpResultActions.httpRequestUpdateSuccessful() 之前完成 loadDetailsAction。
怎样才能做到这一点?来自不同的动作?
@Effect()
removeLibelle$ = this.actions$
.ofType(DetailsActions.DELETE_LIBELLE)
.map(toPayload)
.withLatestFrom(this.store$.select(state => state.tree))
.switchMap(([payload, tree]) => this.libelleService.deleteItem(payload)
.concatMap(() => {
return [
DetailsActions.clear(), //function dispatch action clear
DetailsActions.loadDetails({ entity: tree.entity,
dateSearch: tree.search.dateSearch }), //function dispatch GET
HttpResultActions.httpRequestUpdateSuccessful() //Dispatch action to show modal success
];
}).catch(error => Observable.of(HttpResultActions.httpRequestError(error))));