30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
import {Injectable} from '@angular/core';
|
|
import {HttpClient} from '@angular/common/http';
|
|
import {Observable} from 'rxjs';
|
|
import {Curator} from '../../utils/entities/CuratorInfo';
|
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
|
import {CustomOptions} from "../../services/servicesUtils/customOptions.class";
|
|
|
|
@Injectable()
|
|
export class CuratorService {
|
|
|
|
constructor(private http: HttpClient) {
|
|
}
|
|
|
|
public getCurators(properties: EnvProperties, emails: string): Observable<Curator[]> {
|
|
let url: string = properties.adminToolsAPIURL + '/curator?emails='+emails;
|
|
return this.http.get<Curator[]>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url);
|
|
}
|
|
|
|
public updateCurator(properties: EnvProperties, curator: Curator) {
|
|
let url: string = properties.adminToolsAPIURL + "curator";
|
|
return this.http.post<Curator>(url, curator, CustomOptions.getAuthOptions());
|
|
}
|
|
|
|
public getCurator(properties: EnvProperties, curatorId: string): Observable<Curator> {
|
|
let url: string = properties.adminToolsAPIURL + 'curator/'+curatorId;
|
|
return this.http.get<Curator>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url);
|
|
}
|
|
|
|
}
|