Added Search

This commit is contained in:
j.mei7
2022-03-26 20:11:52 +01:00
parent 303d00b2ab
commit 52f791904a
12 changed files with 244 additions and 489 deletions

View File

@@ -0,0 +1,16 @@
/* tslint:disable:no-unused-variable */
import { TestBed, async, inject } from '@angular/core/testing';
import { PhotonService } from './photon.service';
describe('Service: Photon', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [PhotonService]
});
});
it('should ...', inject([PhotonService], (service: PhotonService) => {
expect(service).toBeTruthy();
}));
});

View File

@@ -0,0 +1,23 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { PhotonFeatureCollection } from '../interfaces/photon';
import { Observable } from 'rxjs';
/**
* Communicates with Photon (https://photon.komoot.io/)
*/
@Injectable({
providedIn: 'root'
})
export class PhotonService{
constructor(private http: HttpClient) { }
/**
* Sends a query request to Photon and gets response (https://photon.komoot.io/)
*/
sendQueryRequest(queryString: string): Observable<PhotonFeatureCollection> {
return this.http.get<PhotonFeatureCollection>("https://photon.komoot.io/api/?q=" + queryString);
}
}