From 80c807bfbab67ee21534b5b11b221762484e8404 Mon Sep 17 00:00:00 2001 From: unknown <pawel999@icloud.com> Date: Wed, 9 Jun 2021 22:26:39 +0200 Subject: [PATCH] Fixed typo in Dockerfile. Added some checks to weather module settings --- Dockerfile | 4 ++-- .../Settings/WeatherSettings/WeatherSettings.tsx | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index edbab39..cd99f47 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,9 @@ FROM node:14-alpine WORKDIR /app -COPY package*.json . +COPY package*.json ./ -RUN npm install --only=production +RUN npm install --production COPY . . diff --git a/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx b/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx index 5eb7255..3294fe4 100644 --- a/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx +++ b/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx @@ -64,6 +64,15 @@ const WeatherSettings = (props: ComponentProps): JSX.Element => { const formSubmitHandler = (e: FormEvent) => { e.preventDefault(); + // Check for api key input + if ((formData.lat || formData.long) && !formData.WEATHER_API_KEY) { + props.createNotification({ + title: 'Warning', + message: 'API Key is missing. Weather Module will NOT work' + }) + } + + // Save settings axios.put<ApiResponse<{}>>('/api/config', formData) .then(() => { props.createNotification({ @@ -111,6 +120,7 @@ const WeatherSettings = (props: ComponentProps): JSX.Element => { target='blank'> {' '}Weather API </a> + . Key is required for weather module to work. </span> </InputGroup> <InputGroup>