Project

General

Profile

1
import {Injectable} from '@angular/core';
2
import {HttpClient} from '@angular/common/http';
3
import {Observable} from 'rxjs';
4
import {Curator} from '../../utils/entities/CuratorInfo';
5
import {EnvProperties} from '../../utils/properties/env-properties';
6
import {CustomOptions} from "../../services/servicesUtils/customOptions.class";
7

    
8
@Injectable()
9
export class CuratorService {
10

    
11
  constructor(private http: HttpClient) {
12
  }
13

    
14
  public getCurators(properties: EnvProperties, communityId: string): Observable<Curator[]> {
15
    let url: string = properties.adminToolsAPIURL + '/' + communityId + '/curator';
16
    return this.http.get<Curator[]>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url);
17
  }
18

    
19
  public updateCurator(properties: EnvProperties, curator: Curator) {
20
    let url: string = properties.adminToolsAPIURL + "curator";
21
    return this.http.post<Curator>(url, curator, CustomOptions.registryOptions());
22
  }
23

    
24
  public getCurator(properties: EnvProperties): Observable<Curator> {
25
    let url: string = properties.adminToolsAPIURL + 'curator';
26
    return this.http.get<Curator>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url, CustomOptions.registryOptions());
27
  }
28

    
29
}
    (1-1/1)