(Mail-ngrx) Fixed a small issue

This commit is contained in:
sercan 2018-10-11 19:28:06 +03:00
parent eeed00b30e
commit e67887f379
2 changed files with 4 additions and 3 deletions

View File

@ -138,10 +138,11 @@ export class MailsEffect
withLatestFrom(this.store.pipe(select(getMailsState))), withLatestFrom(this.store.pipe(select(getMailsState))),
map(([action, state]) => { 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]); return new MailsActions.SetCurrentMailSuccess(state.entities[this.routerState.params.mailId]);
}) })
); );

View File

@ -32,7 +32,7 @@ export class RouterEffects
ofType(RouterActions.GO), ofType(RouterActions.GO),
map((action: RouterActions.Go) => action.payload), map((action: RouterActions.Go) => action.payload),
tap(({path, query: queryParams, extras}) => { tap(({path, query: queryParams, extras}) => {
this.router.navigate(path, {queryParams, ...extras}); this.router.navigate(path, {...queryParams, ...extras});
}) })
); );