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:

refineFieldResults.service.ts
22 22
      let url = link+"&refine=true&page=1&size=0";
23 23
      let key = url;
24 24
      if (this._cache.has(key)) {
25
        return Observable.of(this._cache.get(key));
25
        return Observable.of(this._cache.get(key)).map(res =>  this.parse(res,fieldName));
26 26
      }
27 27
      return this.http.get(url)
28 28
                  .map(res => <any> res.json())
29 29
                  .map(res => res['refineResults'])
30
                  // .do(res => console.info(res))
31
                  .map(res =>  this.parse(res,fieldName))
32 30
                  .do(res => {
33 31
                    this._cache.set(key, res);
34
                  });
32
                  })
33
                  .map(res =>  this.parse(res,fieldName));
35 34

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

Also available in: Unified diff