@@ -5,7 +5,7 @@ import 'rxjs/add/operator/debounceTime';
55import 'rxjs/add/operator/skip' ;
66import 'rxjs/add/operator/takeUntil' ;
77import { Injectable } from '@angular/core' ;
8- import { Effect , Actions } from '@ngrx/effects' ;
8+ import { Effect , Actions , toPayload } from '@ngrx/effects' ;
99import { Action } from '@ngrx/store' ;
1010import { Observable } from 'rxjs/Observable' ;
1111import { empty } from 'rxjs/observable/empty' ;
@@ -17,11 +17,14 @@ import * as book from '../actions/book';
1717
1818/**
1919 * Effects offer a way to isolate and easily test side-effects within your
20- * application. StateUpdates is an observable of the latest state and
21- * dispatched action. The `toPayload` helper function returns just
20+ * application.
21+ * The `toPayload` helper function returns just
2222 * the payload of the currently dispatched action, useful in
2323 * instances where the current state is not necessary.
2424 *
25+ * Documentation on `toPayload` can be found here:
26+ * https://github.com/ngrx/effects/blob/master/docs/api.md#topayload
27+ *
2528 * If you are unfamiliar with the operators being used in these examples, please
2629 * check out the sources below:
2730 *
@@ -38,7 +41,7 @@ export class BookEffects {
3841 search$ : Observable < Action > = this . actions$
3942 . ofType ( book . ActionTypes . SEARCH )
4043 . debounceTime ( 300 )
41- . map ( ( action : book . SearchAction ) => action . payload )
44+ . map ( toPayload )
4245 . switchMap ( query => {
4346 if ( query === '' ) {
4447 return empty ( ) ;
0 commit comments