Project

General

Profile

« Previous | Next » 

Revision 44907

in services use function console.log instead of console.error | re-enable cache for project & organization service | in services add result in cache before custom parsing

View differences:

person.service.ts
36 36
        let url = OpenaireProperties. getSearchAPIURLLast()+'people/'+id+"?format=json";
37 37
        let key = url;
38 38
        if (this._cache.has(key)) {
39
          return Observable.of(this._cache.get(key));
39
          return Observable.of(this._cache.get(key)).map(res => this.parsePersonInfo(res));
40 40
        }
41 41
        return this.http.get(url)
42 42
                    .map(res => <any> res.json())
43 43
                    .map(res => res['result']['metadata']['oaf:entity']['oaf:person'])
44
                    .map(res => this.parsePersonInfo(res))
45 44
                    .do(res => {
46 45
                      this._cache.set(key, res);
47
                    });
46
                    })
47
                    .map(res => this.parsePersonInfo(res));
48 48

  
49 49

  
50 50

  
......
53 53
    private handleError (error: Response) {
54 54
    // in a real world app, we may send the error to some remote logging infrastructure
55 55
    // instead of just logging it to the console
56
        console.error(error);
56
        console.log(error);
57 57
        return Observable.throw(error  || 'Server error');
58 58
    }
59 59

  

Also available in: Unified diff