diff --git a/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx b/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx index a6819d8..4d0b813 100644 --- a/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx +++ b/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx @@ -42,10 +42,10 @@ export const WeatherSettings = (): JSX.Element => { e.preventDefault(); // Check for api key input - if ((formData.lat || formData.long) && !formData.WEATHER_API_KEY) { + if ((formData.lat || formData.long) && !formData.weather_enabled) { createNotification({ title: 'Warning', - message: 'API key is missing. Weather Module will NOT work', + message: 'You need to enable the weather module to use it', }); } @@ -97,25 +97,19 @@ export const WeatherSettings = (): JSX.Element => { return (
formSubmitHandler(e)}> - + {/* API KEY */} - + inputChangeHandler(e)} /> - Using - - {' '} - Weather API - - . Key is required for weather module to work. + Required for weather module to work. diff --git a/client/src/components/Widgets/WeatherWidget/WeatherWidget.tsx b/client/src/components/Widgets/WeatherWidget/WeatherWidget.tsx index d300328..5ff0bce 100644 --- a/client/src/components/Widgets/WeatherWidget/WeatherWidget.tsx +++ b/client/src/components/Widgets/WeatherWidget/WeatherWidget.tsx @@ -58,7 +58,7 @@ export const WeatherWidget = (): JSX.Element => { return (
{configLoading || - (config.WEATHER_API_KEY && weather.id > 0 && ( + (config.weather_enabled && weather.id > 0 && (
{ - const { WEATHER_API_KEY: secret, lat, long } = await loadConfig(); + const { lat, long } = await loadConfig(); // Fetch data from external API try { diff --git a/utils/init/initialConfig.json b/utils/init/initialConfig.json index 929b2fe..3f9a652 100644 --- a/utils/init/initialConfig.json +++ b/utils/init/initialConfig.json @@ -1,5 +1,5 @@ { - "WEATHER_API_KEY": "", + "weather_enabled": false, "lat": 0, "long": 0, "isCelsius": true, diff --git a/utils/jobs.js b/utils/jobs.js index e509ef5..f2cc515 100644 --- a/utils/jobs.js +++ b/utils/jobs.js @@ -7,9 +7,9 @@ const loadConfig = require('./loadConfig'); const logger = new Logger(); module.exports = async function () { - const { WEATHER_API_KEY } = await loadConfig(); + const { weather_enabled } = await loadConfig(); - if (WEATHER_API_KEY != '') { + if (weather_enabled) { // Update weather data every 15 minutes const weatherJob = schedule.scheduleJob( 'updateWeather', @@ -20,7 +20,7 @@ module.exports = async function () { Sockets.getSocket('weather').socket.send(JSON.stringify(weatherData)); } catch (err) { - if (WEATHER_API_KEY) { + if (weather_enabled) { logger.log(err.message, 'ERROR'); } }