From e67887f3790425d132f23df0b340901f6b8f10be Mon Sep 17 00:00:00 2001 From: sercan Date: Thu, 11 Oct 2018 19:28:06 +0300 Subject: [PATCH] (Mail-ngrx) Fixed a small issue --- src/app/main/apps/mail-ngrx/store/effects/mails.effects.ts | 5 +++-- src/app/store/effects/router.effect.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/main/apps/mail-ngrx/store/effects/mails.effects.ts b/src/app/main/apps/mail-ngrx/store/effects/mails.effects.ts index 3e3cddf1..b24a85a5 100644 --- a/src/app/main/apps/mail-ngrx/store/effects/mails.effects.ts +++ b/src/app/main/apps/mail-ngrx/store/effects/mails.effects.ts @@ -138,10 +138,11 @@ export class MailsEffect withLatestFrom(this.store.pipe(select(getMailsState))), map(([action, state]) => { - if ( !state.entities[this.routerState.params.mailId] ) + if ( this.routerState.params.mailId && !state.entities[this.routerState.params.mailId] ) { - return new fromRoot.Go({path: [this.routerState.url.replace(this.routerState.params.mailId, '')]}); + // return new fromRoot.Go({path: [this.routerState.url.replace(this.routerState.params.mailId, '')]}); } + return new MailsActions.SetCurrentMailSuccess(state.entities[this.routerState.params.mailId]); }) ); diff --git a/src/app/store/effects/router.effect.ts b/src/app/store/effects/router.effect.ts index ad3d9546..88a865b6 100644 --- a/src/app/store/effects/router.effect.ts +++ b/src/app/store/effects/router.effect.ts @@ -32,7 +32,7 @@ export class RouterEffects ofType(RouterActions.GO), map((action: RouterActions.Go) => action.payload), tap(({path, query: queryParams, extras}) => { - this.router.navigate(path, {queryParams, ...extras}); + this.router.navigate(path, {...queryParams, ...extras}); }) );