This commit is contained in:
2023-04-06 14:28:53 +02:00
parent a08125c32f
commit 8563bce135
4 changed files with 74 additions and 11 deletions

View File

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