2019-06-02 20:52:26 +02:00
|
|
|
import {Injectable} from '@angular/core';
|
2019-06-03 15:20:36 +02:00
|
|
|
import {HttpClient} from '@angular/common/http';
|
2019-06-05 16:21:38 +02:00
|
|
|
import {Observable} from 'rxjs';
|
2019-06-02 20:52:26 +02:00
|
|
|
import {Curator} from '../../utils/entities/CuratorInfo';
|
|
|
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
2019-06-03 15:20:36 +02:00
|
|
|
import {CustomOptions} from "../../services/servicesUtils/customOptions.class";
|
2019-05-27 10:54:58 +02:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class CuratorService {
|
|
|
|
|
|
|
|
constructor(private http: HttpClient) {
|
|
|
|
}
|
|
|
|
|
2021-02-26 11:48:34 +01:00
|
|
|
public getCurators(properties: EnvProperties, communityId: string): Observable<Curator[]> {
|
|
|
|
let url: string = properties.adminToolsAPIURL + '/' + communityId + '/curator';
|
2020-07-17 01:08:10 +02:00
|
|
|
return this.http.get<Curator[]>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url);
|
2019-06-02 20:52:26 +02:00
|
|
|
}
|
|
|
|
|
2020-04-08 13:25:41 +02:00
|
|
|
public updateCurator(properties: EnvProperties, curator: Curator) {
|
|
|
|
let url: string = properties.adminToolsAPIURL + "curator";
|
2021-02-26 11:48:34 +01:00
|
|
|
return this.http.post<Curator>(url, curator, CustomOptions.registryOptions());
|
2019-05-27 10:54:58 +02:00
|
|
|
}
|
|
|
|
|
2021-02-26 11:48:34 +01:00
|
|
|
public getCurator(properties: EnvProperties): Observable<Curator> {
|
|
|
|
let url: string = properties.adminToolsAPIURL + 'curator';
|
|
|
|
return this.http.get<Curator>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url, CustomOptions.registryOptions());
|
2019-05-27 10:54:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|