list component changes

This commit is contained in:
2023-04-22 12:00:20 +02:00
parent 0bfb42e2df
commit 05bca51814
5 changed files with 71 additions and 27 deletions

View File

@@ -46,7 +46,7 @@ export class positionService{
return deg * (Math.PI / 180)
}
async getLocation() {
async getLocation(): Promise<any> {
console.log('get location');
return new Promise((resolve, reject) => {
if (navigator.geolocation) {
@@ -65,4 +65,5 @@ export class positionService{
});
}
}

View File

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

View File

@@ -5,9 +5,7 @@ import {Injectable} from "@angular/core";
providedIn: 'root'
})
export class TranslateService {
constructor(private deepLService: DeepLService) {
}
constructor(private deepLService: DeepLService) {}
async getData(input: string, lang: string): Promise<string> {
const response = await this.deepLService.translate(input, lang).toPromise();