Skip to content

Commit 65e0b60

Browse files
committed
fix(main.component): adapt code to consider that communitie$ is an observable
1 parent 32a3833 commit 65e0b60

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/app/pages/main/main.component.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ActivatedRoute, Router } from '@angular/router';
22
import { Community, Communities } from '@shared/interfaces';
33
import { Component, Input } from '@angular/core';
4-
import { map } from 'rxjs/operators';
4+
import { map, withLatestFrom } from 'rxjs/operators';
55
import { CommunityService } from '@shared/services';
66

77
@Component({
@@ -11,9 +11,11 @@ import { CommunityService } from '@shared/services';
1111
})
1212
export class MainComponent {
1313
@Input()
14-
/* communities: Communities; */
1514
communitie$ = this.communityService.communities;
16-
community$ = this.route.fragment.pipe(map(community => this.communitie$[community]));
15+
community$ = this.route.fragment.pipe(
16+
withLatestFrom(this.communitie$),
17+
map(([community, communities]) => communities[community]),
18+
);
1719

1820
constructor(
1921
private router: Router,

0 commit comments

Comments
 (0)