File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { Communities } from '@shared/interfaces';
2
2
import { HttpClient } from '@angular/common/http' ;
3
3
import { Injectable } from '@angular/core' ;
4
4
import { Observable } from 'rxjs' ;
5
- import { map } from 'rxjs/operators' ;
5
+ import { map , shareReplay } from 'rxjs/operators' ;
6
6
7
7
@Injectable ( {
8
8
providedIn : 'root' ,
@@ -13,9 +13,10 @@ export class CommunityService {
13
13
constructor ( private httpClient : HttpClient ) { }
14
14
15
15
get communities ( ) : Observable < Communities > {
16
- return this . httpClient
17
- . get < Communities > ( this . JSON_COMMUNITIES )
18
- . pipe ( map ( communities => this . normalizeCommunities ( communities ) ) ) ;
16
+ return this . httpClient . get < Communities > ( this . JSON_COMMUNITIES ) . pipe (
17
+ map ( communities => this . normalizeCommunities ( communities ) ) ,
18
+ shareReplay ( 1 ) ,
19
+ ) ;
19
20
}
20
21
21
22
private normalizeCommunities ( communities : Communities ) : Communities {
You can’t perform that action at this time.
0 commit comments