connect-admin/src/app/services/manageZenodoCommunities.ser...

36 lines
1.3 KiB
TypeScript

import {Injectable} from '@angular/core';
import {HttpClient, HttpHeaders} from '@angular/common/http';
import{EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
@Injectable()
export class ManageZenodoCommunitiesService {
constructor(private http: HttpClient ) {}
removeZCommunity (properties: EnvProperties, pid: string,id: string):any {
//let headers = new Headers({'Content-Type': 'application/json', 'accept': 'application/json'});
//let options = new RequestOptions({headers: headers, body: id});
let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'});
let url = properties.communityAPI + pid + "/zenodocommunities?zenodocommunity="+id;
//return this.http.delete(url, options);
return this.http.request('delete', url, { headers: headers})
}
addZCommunity(properties:EnvProperties, pid: string,zenodoid: string) {
//let headers = new Headers({'Content-Type': 'application/json'});
//let options = new RequestOptions({headers: headers});
let headers = new HttpHeaders({'Content-Type': 'application/json'});
let url = properties.communityAPI+pid+"/zenodocommunities?zenodocommunity="+zenodoid;
return this.http.post<any>(url, headers);
//.map(res => <any> res.json())
}
}