Upgrade action typing with typesafe-actions

This commit is contained in:
James Greenaway
2019-02-12 17:59:55 +00:00
parent 3f14fcc161
commit e482e989de
12 changed files with 59 additions and 93 deletions

View File

@@ -1,11 +1,12 @@
import { combineEpics, Epic, ofType } from 'redux-observable';
import { map, tap, ignoreElements } from 'rxjs/operators';
import { filter, map, tap, ignoreElements } from 'rxjs/operators';
import { isActionOf } from 'typesafe-actions';
import { Action } from '../actions';
import { State } from '../reducer';
import { RootAction, RootState } from '../reducer';
import * as workloadsActions from './actions';
type AppEpic = Epic<Action, Action, State>;
type AppEpic = Epic<RootAction, RootAction, RootState>;
// import { WorkloadService } from './services';
@@ -16,7 +17,7 @@ type AppEpic = Epic<Action, Action, State>;
const logWorkloadSubmissions: AppEpic = (action$, state$) => (
action$.pipe(
ofType('WORKLOAD_SUBMIT'),
filter(isActionOf(workloadsActions.submit)),
map(action => action.payload),
tap((payload) => console.log('Workload submitted', payload)),
ignoreElements(),