diff --git a/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx b/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx index a6819d8..f3e22d6 100644 --- a/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx +++ b/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx @@ -110,10 +110,10 @@ export const WeatherSettings = (): JSX.Element => { onChange={(e) => inputChangeHandler(e)} /> - Using - + Now using + {' '} - Weather API + OpenWeatherMap . Key is required for weather module to work. diff --git a/utils/getExternalWeather.js b/utils/getExternalWeather.js index 300c20f..660d973 100644 --- a/utils/getExternalWeather.js +++ b/utils/getExternalWeather.js @@ -3,13 +3,15 @@ const axios = require('axios'); const loadConfig = require('./loadConfig'); const getExternalWeather = async () => { - const { WEATHER_API_KEY: secret, lat, long } = await loadConfig(); - + const { WEATHER_API_KEY: secret, lat, long, isCelsius } = await loadConfig(); + //units = standard, metric, imperial + const units = isCelsius?'metric':'imperial' + // Fetch data from external API try { const res = await axios.get( - `https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${long}&appid=${secret}&units=metric` + `https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${long}&appid=${secret}&units=${units}` ); // Save weather data @@ -18,7 +20,7 @@ const getExternalWeather = async () => { const weatherData = await Weather.create({ externalLastUpdate: cursor.dt, tempC: cursor.main.temp, - tempF: 0, + tempF: cursor.main.temp, isDay: isDay, cloud: cursor.clouds.all, conditionText: cursor.weather[0].main,