Ajout du cache sur les appels pour les stats
Et appel à l'API sur l'affichage de l'onglet
This commit is contained in:
@@ -5,7 +5,7 @@ import { Observable } from "rxjs";
|
||||
import { GearResp, GearReq } from "../models/gear";
|
||||
|
||||
import { BaseService } from "./base.service";
|
||||
import { RefData } from "../models/ref-data.enum";
|
||||
import { CacheApiKey } from "../models/cache-api-key.enum";
|
||||
|
||||
@Injectable()
|
||||
export class GearService extends BaseService {
|
||||
@@ -15,7 +15,7 @@ export class GearService extends BaseService {
|
||||
|
||||
public getListOfGears(): Observable<Array<GearResp>> {
|
||||
let callToApi = this.http.get<Array<GearResp>>(`${this.apiUrl}/Gear`, { headers: this.headers });
|
||||
return this.serviceRefData.get<Array<GearResp>>(RefData.Gear, callToApi);
|
||||
return this.serviceCacheApi.get<Array<GearResp>>(CacheApiKey.Gear, callToApi);
|
||||
}
|
||||
|
||||
public AddGear(name: string,
|
||||
@@ -37,7 +37,7 @@ export class GearService extends BaseService {
|
||||
reserveCanopy: reserveCanopy
|
||||
};
|
||||
|
||||
this.serviceRefData.delete(RefData.Gear);
|
||||
this.serviceCacheApi.delete(CacheApiKey.Gear);
|
||||
return this.http.post(`${this.apiUrl}/Gear`, bodyNewGear, { headers: this.headers});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user