瀏覽代碼

Fixed typo in Dockerfile. Added some checks to weather module settings

unknown 4 年之前
父節點
當前提交
80c807bfba
共有 2 個文件被更改,包括 12 次插入2 次删除
  1. 2 2
      Dockerfile
  2. 10 0
      client/src/components/Settings/WeatherSettings/WeatherSettings.tsx

+ 2 - 2
Dockerfile

@@ -2,9 +2,9 @@ FROM node:14-alpine
 
 
 WORKDIR /app
 WORKDIR /app
 
 
-COPY package*.json .
+COPY package*.json ./
 
 
-RUN npm install --only=production
+RUN npm install --production
 
 
 COPY . .
 COPY . .
 
 

+ 10 - 0
client/src/components/Settings/WeatherSettings/WeatherSettings.tsx

@@ -64,6 +64,15 @@ const WeatherSettings = (props: ComponentProps): JSX.Element => {
   const formSubmitHandler = (e: FormEvent) => {
   const formSubmitHandler = (e: FormEvent) => {
     e.preventDefault();
     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)
     axios.put<ApiResponse<{}>>('/api/config', formData)
       .then(() => {
       .then(() => {
         props.createNotification({
         props.createNotification({
@@ -111,6 +120,7 @@ const WeatherSettings = (props: ComponentProps): JSX.Element => {
             target='blank'>
             target='blank'>
             {' '}Weather API
             {' '}Weather API
           </a>
           </a>
+          . Key is required for weather module to work.
         </span>
         </span>
       </InputGroup>
       </InputGroup>
       <InputGroup>
       <InputGroup>