From 65e0b605442760ac49ee59fa677d288a24088dc4 Mon Sep 17 00:00:00 2001 From: Nya Garcia Date: Fri, 26 Jun 2020 13:54:08 +0200 Subject: [PATCH] fix(main.component): adapt code to consider that communitie$ is an observable --- src/app/pages/main/main.component.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/pages/main/main.component.ts b/src/app/pages/main/main.component.ts index ac72ddf..817733b 100644 --- a/src/app/pages/main/main.component.ts +++ b/src/app/pages/main/main.component.ts @@ -1,7 +1,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import { Community, Communities } from '@shared/interfaces'; import { Component, Input } from '@angular/core'; -import { map } from 'rxjs/operators'; +import { map, withLatestFrom } from 'rxjs/operators'; import { CommunityService } from '@shared/services'; @Component({ @@ -11,9 +11,11 @@ import { CommunityService } from '@shared/services'; }) export class MainComponent { @Input() - /* communities: Communities; */ communitie$ = this.communityService.communities; - community$ = this.route.fragment.pipe(map(community => this.communitie$[community])); + community$ = this.route.fragment.pipe( + withLatestFrom(this.communitie$), + map(([community, communities]) => communities[community]), + ); constructor( private router: Router,