Project

General

Profile

1 61381 k.triantaf
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 SearchCommunityDataprovidersService {
8
    constructor(private http: HttpClient ) {}
9
    searchDataproviders (properties:EnvProperties, pid: string):any {
10
        let url = properties.communityAPI+pid+"/contentproviders";
11
12
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
13
    }
14
    countTotalDataproviders(properties:EnvProperties,pid:string) {
15
        let url = properties.communityAPI+pid+"/contentproviders";
16
        return  this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
17
          .pipe(map(res => res['length']));
18
    }
19
}