Revision 55907
Added by Konstantina Galouni almost 5 years ago
manageZenodoCommunities.service.ts | ||
---|---|---|
1 | 1 |
import {Injectable} from '@angular/core'; |
2 |
import {Http, Response, Headers, RequestOptions} from '@angular/http'; |
|
3 |
import {Observable} from 'rxjs/Observable'; |
|
2 |
import {HttpClient, HttpHeaders} from '@angular/common/http'; |
|
4 | 3 |
import{EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; |
5 | 4 |
|
6 |
import { HttpErrorResponse, HttpResponse } from '@angular/common/http'; |
|
7 |
import { ErrorObservable } from 'rxjs/observable/ErrorObservable'; |
|
8 |
import { catchError } from 'rxjs/operators'; |
|
9 |
|
|
10 | 5 |
@Injectable() |
11 | 6 |
export class ManageZenodoCommunitiesService { |
12 |
constructor(private http: Http ) {} |
|
7 |
constructor(private http: HttpClient ) {}
|
|
13 | 8 |
|
14 | 9 |
removeZCommunity (properties: EnvProperties, communityId: string,id: string):any { |
15 |
let headers = new Headers({'Content-Type': 'application/json', 'accept': 'application/json'}); |
|
16 |
let options = new RequestOptions({headers: headers, body: id}); |
|
10 |
//let headers = new Headers({'Content-Type': 'application/json', 'accept': 'application/json'});
|
|
11 |
//let options = new RequestOptions({headers: headers, body: id});
|
|
17 | 12 |
|
13 |
let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'}); |
|
18 | 14 |
let url = properties.communityAPI + communityId + "/zenodocommunities"; |
19 | 15 |
|
20 |
return this.http.delete(url, options); |
|
16 |
//return this.http.delete(url, options); |
|
17 |
return this.http.request('delete', url, { body: id, headers: headers}) |
|
21 | 18 |
} |
22 | 19 |
|
23 | 20 |
addZCommunity(properties:EnvProperties, communityId: string,zenodoid: string) { |
24 |
let headers = new Headers({'Content-Type': 'application/json'}); |
|
25 |
let options = new RequestOptions({headers: headers}); |
|
21 |
//let headers = new Headers({'Content-Type': 'application/json'});
|
|
22 |
//let options = new RequestOptions({headers: headers});
|
|
26 | 23 |
|
24 |
let headers = new HttpHeaders({'Content-Type': 'application/json'}); |
|
25 |
|
|
27 | 26 |
let url = properties.communityAPI+communityId+"/zenodocommunities"; |
28 | 27 |
var zCommunity: any = { |
29 | 28 |
"communityId": communityId, |
30 | 29 |
|
31 | 30 |
"zenodoid": zenodoid |
32 | 31 |
}; |
33 |
return this.http.post(url, JSON.stringify(zCommunity), options)
|
|
34 |
.map(res => <any> res.json()) |
|
32 |
return this.http.post<any>(url, JSON.stringify(zCommunity), {headers: headers});
|
|
33 |
//.map(res => <any> res.json())
|
|
35 | 34 |
} |
36 | 35 |
|
37 | 36 |
|
Also available in: Unified diff
[angular7 | Admin]:
1. Move uoa-admin-portal project to Angular 7 (interactivemining library needs to be updated too)
2. Delete unsused components: delete-confirmation-dialog, modal-form.component