Modification de la récupération des sauts et mapping entre les IDs des données référentielles et les données présentes dans le cache.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Injectable } from "@angular/core";
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { Observable } from "rxjs";
|
||||
import { map } from "rxjs/operators";
|
||||
|
||||
import { GearResp, GearReq } from "../models/gear";
|
||||
|
||||
@@ -40,4 +41,11 @@ export class GearService extends BaseService {
|
||||
this.serviceCacheApi.delete(CacheApiKey.Gear);
|
||||
return this.http.post(`${this.apiUrl}/Gear`, bodyNewGear, { headers: this.headers});
|
||||
}
|
||||
|
||||
public getById(id: number) : Observable<GearResp> {
|
||||
return this.serviceCacheApi.getByKey<Array<GearResp>>(CacheApiKey.Gear)
|
||||
.pipe(map(data => {
|
||||
return data.find(f => f.id === id);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user