0
안녕하세요 저는 "loadFullService $"효과에서 새로운 작업 "LoadConfig"를 보내고 싶습니다.하나의 효과에서 여러 작업 발송
하는 방법? 생성자에서
@Effect()
loadFullService$: Observable<Action> = this.actions$
.ofType<servicesActions.LoadFullService>(servicesActions.LOAD_FULL_SERVICE)
.switchMap(action => {
return this.apiService
.loadFullService(action.payload)
.map((service: Service) => new servicesActions.LoadFullServiceSuccess(service))
.catch(error => of(new servicesActions.LoadFailureAction(error)));
})
;
@Effect()
loadConfig$: Observable<Action> = this.actions$
.ofType<servicesActions.LoadConfig>(servicesActions.LOAD_CONFIG)
.switchMap(action => {
console.log("action config", action);
return this.apiService
.loadConfig(action.id, action.name)
.map((config: Configuration) => new servicesActions.LoadConfigSuccess(config))
.catch(error => of(new servicesActions.LoadConfigFailure(error)));
});
들으 유
하지만 효과에 무엇을해야합니까? .do (this.store.dispatch (새 servicesActions.LoadConfig (action.id, action.name))))? –
예, 답변을 –
Thx u! 업데이트했습니다. 마지막 질문 "LoadFullService"액션의 반환 값인 "name"이 필요합니다. 다시 가져올 수 있습니까? –