Project

General

Profile

« Previous | Next » 

Revision 52772

fixed some bugs and changed to HttpClient

View differences:

piwik.service.ts
28 28
              private httpClient: HttpClient) { }
29 29

  
30 30

  
31
  approvePiwikSite(repositoryId: string): Observable<string> {
31
  approvePiwikSite(repositoryId: string) {
32 32
    let url = `${this.apiUrl}approvePiwikSite/${repositoryId}`;
33 33
    console.log(`knocking on: ${url}`);
34
    return this.httpClient.get<string>(url);
34
    return this.httpClient.get(url, {withCredentials: true, responseType: 'text'});
35 35
  }
36 36

  
37
  enableMetricsForRepository(repoName: string, repoWebsite: string, piwik: PiwikInfo): Observable<string> {
37
  enableMetricsForRepository(repoName: string, repoWebsite: string, piwik: PiwikInfo): Observable<PiwikInfo> {
38 38
    let url = `${this.apiUrl}enableMetricsForRepository?officialName=${encodeURIComponent(repoName)}&repoWebsite=${encodeURIComponent(repoWebsite)}`;
39 39
    console.log(`knocking on: ${url}`);
40 40
    console.log(`sending ${JSON.stringify(piwik)}`);
41 41

  
42
    return this.httpClient.post<string>(url,JSON.stringify(piwik),headerOptions);
42
    return this.httpClient.post<PiwikInfo>(url, JSON.stringify(piwik),headerOptions);
43 43
  }
44 44

  
45
  getOpenaireId(id: string): Observable<string> {
45
  getOpenaireId(id: string) {
46 46
    let url = `${this.apiUrl}getOpenaireId/${id}`;
47 47
    console.log(`knocking on: ${url}`);
48 48

  
49
    return this.httpClient.get(url, headerOptions).map( oaId => oaId['_body'].toString() );
49
    return this.httpClient.get(url, {withCredentials: true, responseType: 'text'});
50 50
  }
51 51

  
52 52
  getPiwikInfo(id: string): Observable<PiwikInfo> {
......
64 64
  }
65 65

  
66 66

  
67
  markPiwikSiteAsValidated (repositoryId: string): Observable<string> {
67
  markPiwikSiteAsValidated (repositoryId: string) {
68 68
    let url = `${this.apiUrl}markPiwikSiteAsValidated/${repositoryId}`;
69 69
    console.log(`knocking on: ${url}`);
70
    const body = {};
70 71

  
71
    return this.httpClient.post<any>(url,{withCredentials: true, responseType:'text'});
72
    return this.httpClient.post(url, body,{withCredentials: true, responseType:'text'});
72 73
  }
73 74

  
74 75
  savePiwikInfo(piwik: PiwikInfo): Observable<PiwikInfo> {

Also available in: Unified diff