From 202c7253e60df6e52a16d6710524b6fe351bfe06 Mon Sep 17 00:00:00 2001 From: "sofia.baltzi" Date: Tue, 20 Mar 2018 11:40:39 +0000 Subject: [PATCH] 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 --- connect/community/community.service.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/connect/community/community.service.ts b/connect/community/community.service.ts index 615c37bc..3359fbbd 100644 --- a/connect/community/community.service.ts +++ b/connect/community/community.service.ts @@ -14,9 +14,19 @@ export class CommunityService { getCommunity(url: string) { return this.http.get(url).map(res => 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 => 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;