2018-03-29 16:15:47 +02:00
|
|
|
import {Injectable} from '@angular/core';
|
2019-06-03 15:20:36 +02:00
|
|
|
import {HttpClient} from "@angular/common/http";
|
2018-03-29 16:15:47 +02:00
|
|
|
import{EnvProperties} from '../../utils/properties/env-properties';
|
2019-06-05 15:33:18 +02:00
|
|
|
import {map} from "rxjs/operators";
|
2018-03-29 16:15:47 +02:00
|
|
|
|
|
|
|
@Injectable()
|
2018-04-04 14:35:31 +02:00
|
|
|
export class SearchCommunityProjectsService {
|
2019-06-03 15:20:36 +02:00
|
|
|
constructor(private http: HttpClient ) {}
|
2018-03-29 16:15:47 +02:00
|
|
|
|
2020-04-08 13:25:41 +02:00
|
|
|
searchProjects (properties:EnvProperties, pid: string):any {
|
|
|
|
let url = properties.communityAPI+pid+"/projects";
|
2018-03-29 16:15:47 +02:00
|
|
|
|
2019-06-03 15:20:36 +02:00
|
|
|
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
|
|
|
|
//.map(res => <any> res.json())
|
2018-03-29 16:15:47 +02:00
|
|
|
}
|
2020-04-08 13:25:41 +02:00
|
|
|
countTotalProjects(properties:EnvProperties,pid:string) {
|
|
|
|
let url = properties.communityAPI+pid+"/projects";
|
2019-06-05 15:33:18 +02:00
|
|
|
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
|
|
|
.pipe(map(res => res['length']));
|
|
|
|
}
|
2018-03-29 16:15:47 +02:00
|
|
|
}
|