list component changes
This commit is contained in:
@@ -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{
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user