Add updateCommunity method to community.service

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51342 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
sofia.baltzi 2018-03-20 11:40:39 +00:00
parent dee73981fc
commit 202c7253e6
1 changed files with 10 additions and 0 deletions

View File

@ -14,9 +14,19 @@ export class CommunityService {
getCommunity(url: string) {
return this.http.get(url).map(res => <any> res.json()).map(res => this.parseCommunity(res));
}
updateCommunity(url: string, community:any) {
let body = JSON.stringify(community);
return this.http.post(url, body)
.map(res => res.json())
.do(request => console.log("Insert Response:"+request.status));
}
iscommunityManager(url: string, manager:string){
return this.http.get(url).map(res => <any> res.json()).map(res => this.parseCommunity(res)).map(community => community.managers.indexOf(manager)!=-1);
}
parseCommunity(data:any): CommunityInfo {
let length = Array.isArray(data) ? data.length :1;