mirror of
https://github.com/DerTyp7/street-map-typescript.git
synced 2025-10-30 05:07:12 +01:00
18 lines
564 B
TypeScript
18 lines
564 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { HttpClient } from '@angular/common/http';
|
|
import { Photon } from './interfaces/photon';
|
|
import { Observable } from 'rxjs';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
|
|
// communicates with Photon (https://photon.komoot.io/)
|
|
export class PhotonService{
|
|
constructor(private http: HttpClient) { }
|
|
|
|
// sends a query request to Photon and gets response (https://photon.komoot.io/)
|
|
sendQueryRequest(q: string): Observable<Photon[]> {
|
|
return this.http.get<Photon[]>("https://photon.komoot.io/api/?q=" + q);
|
|
}
|
|
} |