Is there a more efficient way to map each object of the result (Rxjs Observable) to another object when querying an array of objects using angular HttpClient?
Currently, I'm implementing it like this but is there a way to eliminate the need for "double mapping"?
In this scenario, the desired outcome should be Observable<Entry[]>
with the constructor invoked for each Entry
-object:
public getList(): Observable<Entry[]> {
const url = "/entries/";
return this.httpClient.get<Entry[]>(url)
.map((entries: any[]) => entries.map((e) => new Entry(e)));
}