mirror of
https://github.com/DerTyp7/street-map-typescript.git
synced 2025-10-30 13:17:10 +01:00
added Photon Service & interface
This commit is contained in:
18
src/app/photon.service.ts
Normal file
18
src/app/photon.service.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user