From 803dd44a683508b664a40c0496eec314f0a95f61 Mon Sep 17 00:00:00 2001 From: "sofia.baltzi" Date: Wed, 28 Feb 2018 10:19:20 +0000 Subject: [PATCH] Move getCommunity to Community folder and rename parseCommunities to searchCommunity git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@50965 d315682c-612b-4755-9ff5-7f18f6832af3 --- src/app/communities/communities.service.ts | 46 ---------------------- src/app/community/community.component.ts | 2 +- src/app/community/community.service.ts | 46 ++++++++++++++++++++++ 3 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/app/communities/communities.service.ts b/src/app/communities/communities.service.ts index bc6f64d..bbccf41 100644 --- a/src/app/communities/communities.service.ts +++ b/src/app/communities/communities.service.ts @@ -14,10 +14,6 @@ export class CommunitiesService { return this.http.get(url).map(res => res.json()).map(res => this.parseResults(res)); } - getCommunity(id:string , url: string) { - return this.http.get(url).map(res => res.json()).map(res => this.parseCommunities(id,res)); - } - parseResults(data: any): CommunityInfo[] { let communities: CommunityInfo[] = []; @@ -49,46 +45,4 @@ export class CommunitiesService { return communities; } - - parseCommunities(id:string, data:any): CommunityInfo[] { - let community: CommunityInfo[] = []; - - let notFound:boolean = true; - - let length = Array.isArray(data) ? data.length :1; - - for (let i=0; i { this.communityInfo = communityInfo; console.log(communityInfo); diff --git a/src/app/community/community.service.ts b/src/app/community/community.service.ts index 042b98a..94b2e9f 100644 --- a/src/app/community/community.service.ts +++ b/src/app/community/community.service.ts @@ -3,6 +3,7 @@ import { Http, Response, Headers, RequestOptions } from '@angular/http'; import { Observable } from 'rxjs/Rx'; import { ResultInfo } from './results/resultInfo'; +import { CommunityInfo } from '../utils/communityInfo'; @Injectable() export class CommunityService { @@ -94,4 +95,49 @@ export class CommunityService { return results; } + getCommunity(id:string , url: string) { + return this.http.get(url).map(res => res.json()).map(res => this.searchCommunity(id,res)); + } + + searchCommunity(id:string, data:any): CommunityInfo[] { + let community: CommunityInfo[] = []; + + let notFound:boolean = true; + + let length = Array.isArray(data) ? data.length :1; + + for (let i=0; i