fix getWaypoints

This commit is contained in:
2023-04-15 15:08:58 +02:00
parent 9d38faaba4
commit 0be4c2fadc

View File

@@ -39,18 +39,22 @@ export class ReadjsonService{
); );
} }
/*
getWaypoints(location: string, id: number): Observable<waypoint[]> { getWaypoints(location: string, id: number): Observable<waypoint[]> {
return this.locations.pipe( return this.locations.pipe(
map((locations) => { map((locations) => {
const foundLocation: Locations | undefined = locations.find((loc: Locations) => loc.location === location); const foundLocation: Locations | undefined = locations.find((loc: Locations) => loc.location === location);
if (foundLocation?.waypoints) {
return foundLocation ? foundLocation.waypoints.filter((way: waypoint) => way.id === id) : []; return foundLocation ? foundLocation.waypoints.filter((way: waypoint) => way.id === id) : [];
} else {
return [];
}
}), }),
tap(data => console.log("data requested", data)) tap(data => console.log("data requested", data))
); );
} }
*/
} }