mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-01-10 04:25:08 +00:00
(MailNgrx) Fixed depreciated ngrx/rxjs stuff
This commit is contained in:
parent
9630d0154f
commit
0b2af161f4
|
@ -51,7 +51,7 @@ export class ContactsMainSidebarComponent implements OnInit, OnDestroy
|
||||||
/**
|
/**
|
||||||
* On destroy
|
* On destroy
|
||||||
*/
|
*/
|
||||||
ngOnDestroy()
|
ngOnDestroy(): void
|
||||||
{
|
{
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next();
|
this._unsubscribeAll.next();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Action, Store } from '@ngrx/store';
|
import { Action, select, Store } from '@ngrx/store';
|
||||||
import { Actions, Effect, ofType } from '@ngrx/effects';
|
import { Actions, Effect, ofType } from '@ngrx/effects';
|
||||||
|
|
||||||
import { Observable, of, forkJoin } from 'rxjs';
|
import { Observable, of, forkJoin } from 'rxjs';
|
||||||
|
@ -24,7 +24,9 @@ export class MailsEffect
|
||||||
private store: Store<State>
|
private store: Store<State>
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.store.select(getRouterState).subscribe(routerState => {
|
this.store
|
||||||
|
.pipe(select(getRouterState))
|
||||||
|
.subscribe(routerState => {
|
||||||
if ( routerState )
|
if ( routerState )
|
||||||
{
|
{
|
||||||
this.routerState = routerState.state;
|
this.routerState = routerState.state;
|
||||||
|
@ -101,11 +103,9 @@ export class MailsEffect
|
||||||
.pipe(
|
.pipe(
|
||||||
ofType<MailsActions.UpdateMails>(MailsActions.UPDATE_MAILS),
|
ofType<MailsActions.UpdateMails>(MailsActions.UPDATE_MAILS),
|
||||||
exhaustMap((action) => {
|
exhaustMap((action) => {
|
||||||
return forkJoin(
|
return forkJoin(action.payload.map(mail => this.mailService.updateMail(mail))).pipe(map(() => {
|
||||||
action.payload.map(mail => this.mailService.updateMail(mail)),
|
|
||||||
() => {
|
|
||||||
return new MailsActions.UpdateMailsSuccess();
|
return new MailsActions.UpdateMailsSuccess();
|
||||||
});
|
}));
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ export class MailsEffect
|
||||||
this.actions
|
this.actions
|
||||||
.pipe(
|
.pipe(
|
||||||
ofType<MailsActions.SetCurrentMail>(MailsActions.SET_CURRENT_MAIL),
|
ofType<MailsActions.SetCurrentMail>(MailsActions.SET_CURRENT_MAIL),
|
||||||
withLatestFrom(this.store.select(getMailsState)),
|
withLatestFrom(this.store.pipe(select(getMailsState))),
|
||||||
map(([action, state]) => {
|
map(([action, state]) => {
|
||||||
return new MailsActions.SetCurrentMailSuccess(state.entities[action.payload]);
|
return new MailsActions.SetCurrentMailSuccess(state.entities[action.payload]);
|
||||||
})
|
})
|
||||||
|
@ -135,7 +135,7 @@ export class MailsEffect
|
||||||
this.actions
|
this.actions
|
||||||
.pipe(
|
.pipe(
|
||||||
ofType<MailsActions.CheckCurrentMail>(MailsActions.CHECK_CURRENT_MAIL),
|
ofType<MailsActions.CheckCurrentMail>(MailsActions.CHECK_CURRENT_MAIL),
|
||||||
withLatestFrom(this.store.select(getMailsState)),
|
withLatestFrom(this.store.pipe(select(getMailsState))),
|
||||||
map(([action, state]) => {
|
map(([action, state]) => {
|
||||||
|
|
||||||
if ( !state.entities[this.routerState.params.mailId] )
|
if ( !state.entities[this.routerState.params.mailId] )
|
||||||
|
@ -200,7 +200,7 @@ export class MailsEffect
|
||||||
.pipe(
|
.pipe(
|
||||||
ofType<MailsActions.SetFolderOnSelectedMails>(MailsActions.SET_FOLDER_ON_SELECTED_MAILS),
|
ofType<MailsActions.SetFolderOnSelectedMails>(MailsActions.SET_FOLDER_ON_SELECTED_MAILS),
|
||||||
withLatestFrom(
|
withLatestFrom(
|
||||||
this.store.select(getMailsState)),
|
this.store.pipe(select(getMailsState))),
|
||||||
map(([action, state]) => {
|
map(([action, state]) => {
|
||||||
const entities = {...state.entities};
|
const entities = {...state.entities};
|
||||||
let mailsToUpdate = [];
|
let mailsToUpdate = [];
|
||||||
|
@ -227,7 +227,7 @@ export class MailsEffect
|
||||||
this.actions
|
this.actions
|
||||||
.pipe(
|
.pipe(
|
||||||
ofType<MailsActions.AddLabelOnSelectedMails>(MailsActions.ADD_LABEL_ON_SELECTED_MAILS),
|
ofType<MailsActions.AddLabelOnSelectedMails>(MailsActions.ADD_LABEL_ON_SELECTED_MAILS),
|
||||||
withLatestFrom(this.store.select(getMailsState)),
|
withLatestFrom(this.store.pipe(select(getMailsState))),
|
||||||
map(([action, state]) => {
|
map(([action, state]) => {
|
||||||
|
|
||||||
const entities = {...state.entities};
|
const entities = {...state.entities};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user