Project

General

Profile

1
import {Injectable} from '@angular/core';
2
import {HttpClient} from "@angular/common/http";
3
import{EnvProperties} from '../../utils/properties/env-properties';
4
import {map} from "rxjs/operators";
5

    
6
@Injectable()
7
export class SearchCommunityProjectsService {
8
    constructor(private http: HttpClient ) {}
9

    
10
    searchProjects (properties:EnvProperties, pid: string):any {
11
        let url = properties.communityAPI+pid+"/projects";
12

    
13
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
14
                    //.map(res => <any> res.json())
15
    }
16
    countTotalProjects(properties:EnvProperties,pid:string) {
17
        let url = properties.communityAPI+pid+"/projects";
18
        return  this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
19
          .pipe(map(res => res['length']));
20
    }
21
}
(1-1/2)