AW-811: Changed weatherservice
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good

This commit is contained in:
Mark van der Wal 2020-02-04 17:38:04 +01:00
parent 1bec8c2038
commit 1cab239155

View File

@ -9,14 +9,14 @@ import {WeatherCurrentObservation} from '../models/weatherCurrentObservation';
})
export class WeatherService {
private apiUrl = '/api/v1/weather/currentobservation';
private apiKey = '5f17ef36283b49e9b099a1f4064fbf3d';
constructor(public httpClient: HttpClient, public appConfig: AppConfig) {
}
public GetCurrentObservation(centroid: number[]): Observable<WeatherCurrentObservation> {
const endpoint = this.appConfig.getConfig('apiEndPoint');
const observationUrl = `${endpoint}${this.apiUrl}/?c=${centroid[0]},${centroid[1]}&key=${this.apiKey}`;
const endpoint = this.appConfig.getConfig('weatherApiEndPoint');
const apiKey = this.appConfig.getConfig('weatherApiKey');
const observationUrl = `${endpoint}${this.apiUrl}/?c=${centroid[0]},${centroid[1]}&key=${apiKey}`;
return this.httpClient.get<WeatherCurrentObservation>(observationUrl);
}