Skip to content

Commit

Permalink
fix(lolapi): requests are not cached
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveVanOpstal committed Dec 22, 2016
1 parent e0eb489 commit dd8a6a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/client/services/lolapi.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ export class LolApiService {

private cache(url: string): Observable<any> {
if (!this.cachedObservables[url]) {
this.cachedObservables[url] = this.http.get(url);
this.cachedObservables[url] = Observable.defer(() => this.http.get(url)).publish().refCount();
}
return this.cachedObservables[url].map(res => res.json());
return this.cachedObservables[url].take(1).map(res => res.json());
}

private getUrl(endpoint: Endpoint, url: string): Observable<string> {
Expand Down

0 comments on commit dd8a6a1

Please sign in to comment.