Revision 59303
Added by Konstantina Galouni over 3 years ago
communities.service.ts | ||
---|---|---|
12 | 12 |
public communities: BehaviorSubject<CommunityInfo[]> = null; |
13 | 13 |
|
14 | 14 |
constructor(private http: HttpClient) { |
15 |
this.communities = new BehaviorSubject(null);
|
|
15 |
this.communities = new BehaviorSubject([]);
|
|
16 | 16 |
} |
17 | 17 |
|
18 | 18 |
updateCommunities(properties: EnvProperties, url: string) { |
19 | 19 |
this.getCommunities(properties, url).subscribe(res => { |
20 |
this.communities.next(res); |
|
20 |
this.communities.next(res); |
|
21 |
}, error => { |
|
22 |
this.communities.error(error); |
|
21 | 23 |
}) |
22 | 24 |
} |
23 | 25 |
|
... | ... | |
27 | 29 |
|
28 | 30 |
getCommunities(properties: EnvProperties, url: string) { |
29 | 31 |
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) |
30 |
//.map(res => <any> res.json()) |
|
31 | 32 |
.pipe(map(res => this.parseCommunities(res))); |
32 | 33 |
} |
33 | 34 |
|
Also available in: Unified diff
[use-UoaAdminToolsLibrary | Library]: Merge trunk into branch.