rxjs upgrade

This commit is contained in:
Sercan Yemen 2018-05-05 14:42:18 +03:00
parent f4636d9a37
commit 1c4983c756

View File

@ -1,10 +1,10 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Action, Store } from '@ngrx/store'; import { Action, Store } from '@ngrx/store';
import { Actions, Effect } from '@ngrx/effects'; import { Actions, Effect } from '@ngrx/effects';
import { Observable } from 'rxjs/Observable'; import { Observable, of } from 'rxjs';
import { of } from 'rxjs/observable/of'; import { catchError, map, mergeMap, exhaustMap, withLatestFrom } from 'rxjs/operators';
import { map, mergeMap, exhaustMap, withLatestFrom } from 'rxjs/operators';
import 'rxjs/add/operator/debounceTime'; import 'rxjs/add/operator/debounceTime';
import { getRouterState, State } from 'app/store/reducers'; import { getRouterState, State } from 'app/store/reducers';
import { getMailsState } from '../selectors'; import { getMailsState } from '../selectors';
import * as MailsActions from '../actions/mails.actions'; import * as MailsActions from '../actions/mails.actions';
@ -48,7 +48,7 @@ export class MailsEffect
value: '' value: ''
}; };
const routeParams = Observable.of('labelHandle', 'filterHandle', 'folderHandle'); const routeParams = of('labelHandle', 'filterHandle', 'folderHandle');
routeParams.subscribe(param => { routeParams.subscribe(param => {
if ( this.routerState.params[param] ) if ( this.routerState.params[param] )
{ {
@ -60,14 +60,16 @@ export class MailsEffect
}); });
return this.mailService.getMails(handle) return this.mailService.getMails(handle)
.map((mails: Mail[]) => { .pipe(
map((mails: Mail[]) => {
return new MailsActions.GetMailsSuccess({ return new MailsActions.GetMailsSuccess({
loaded: handle, loaded: handle,
mails : mails mails : mails
}); });
}) }),
.catch(err => of(new MailsActions.GetMailsFailed(err))); catchError(err => of(new MailsActions.GetMailsFailed(err)))
);
}) })
); );