You should move map() and catchError() to swithchMap() as follows
@Effect() public event_response$ = this.action$.pipe( ofType(SEND_EVENT_RESPONSE_ACTION), switchMap((payload) => { return this.myService.eventResponse(payload.eventId,payload.response).pipe( map((data: DataType) => new SentEventResponseAction(data)), catchError((error) => Observable.of(new ErrorOccurredAction(error))) }) ); );
Note that the evetResponse() method inside myService must return an observable in order to use pipe later. If your method inside the service returns Promise , you can convert it to observable using from the rxjs package, as shown below:
import { from } from 'rxjs'; ... const promise = this.myService.eventResponse(payload.eventId,payload.response); const observable = from(promise); return observable.pipe(...
For a more detailed description, see this link.
source share