import 'rxjs/add/operator/switchMap'; import {IAction} from '@dezrez/core'; import {ActionsObservable, Epic} from 'redux-observable'; import {ActionTypes, NegotiatorActions} from '../actions/negotiator'; import {negotiatorService} from '../services/negotiatorService'; export const negotiatorEpic: Epic = action$ => action$.ofType(ActionTypes.GET) .switchMap(action => negotiatorService.me() .map(neg => NegotiatorActions.store(neg)) );