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, communityId: 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 + communityId + "/zenodocommunities"; //return this.http.delete(url, options); return this.http.request('delete', url, { body: id, headers: headers}) } addZCommunity(properties:EnvProperties, communityId: 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+communityId+"/zenodocommunities"; var zCommunity: any = { "communityId": communityId, "zenodoid": zenodoid }; return this.http.post(url, JSON.stringify(zCommunity), {headers: headers}); //.map(res => res.json()) } }