diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index b96db16..4d846b0 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -71,17 +71,17 @@ export class CommunityComponent { }); - this._communityService.getNumberOfPublications().subscribe( + this._communityService.getTotal('http://beta.services.openaire.eu:8480/search/rest/v2/api/publications/count?format=json&fq=communityid=egi').subscribe( publicationTotal => { this.publicationTotal = publicationTotal; }); - this._communityService.getNumberOfResearchData().subscribe( + this._communityService.getTotal('http://beta.services.openaire.eu:8480/search/rest/v2/api/datasets/count?format=json&fq=communityid=egi').subscribe( researchDataTotal => { this.researchDataTotal = researchDataTotal; }); - this._communityService.getNumberOfSoftware().subscribe( + this._communityService.getTotal('http://beta.services.openaire.eu:8480/search/rest/v2/api/software/count?format=json&fq=communityid=egi').subscribe( softwareTotal => { this.softwareTotal = softwareTotal; }); diff --git a/src/app/community/community.service.ts b/src/app/community/community.service.ts index 94b2e9f..ab8f9c3 100644 --- a/src/app/community/community.service.ts +++ b/src/app/community/community.service.ts @@ -13,19 +13,9 @@ export class CommunityService { constructor(private http:Http) { } - getNumberOfPublications() { - return this.http.get('http://beta.services.openaire.eu:8480/search/rest/v2/api/publications/count?format=json&fq=communityid=egi') - .map(res => res.json()).map(res => res.total).do(res => {console.log(res)}); - } - - getNumberOfResearchData() { - return this.http.get('http://beta.services.openaire.eu:8480/search/rest/v2/api/datasets/count?format=json&fq=communityid=egi') - .map(res => res.json()).map(res => res.total).do(res => {console.log(res)}); - } - - getNumberOfSoftware() { - return this.http.get('http://beta.services.openaire.eu:8480/search/rest/v2/api/software/count?format=json&fq=communityid=egi') - .map(res => res.json()).map(res => res.total).do(res => {console.log(res)}); + getTotal(url: string) { + return this.http.get(url) + .map(res => res.json()).map(res => res.total).do(res => {console.log(res)}); } getResults(url: string) {