Add ENDPOINT_ROOT to Env constants, replace usages.

This commit is contained in:
Rick Watson 2019-08-09 20:33:15 +01:00
parent 2a8599d855
commit 5069cd90a1
3 changed files with 6 additions and 3 deletions

View File

@ -1,4 +1,4 @@
const ENDPOINT_ROOT = process.env.REACT_APP_ENDPOINT_ROOT; import { ENDPOINT_ROOT } from '../constants/Env';
export const NTP_STATUS_ENDPOINT = ENDPOINT_ROOT + "ntpStatus"; export const NTP_STATUS_ENDPOINT = ENDPOINT_ROOT + "ntpStatus";
export const NTP_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "ntpSettings"; export const NTP_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "ntpSettings";

View File

@ -1,2 +1,3 @@
export const PROJECT_NAME = process.env.REACT_APP_PROJECT_NAME; export const PROJECT_NAME = process.env.REACT_APP_PROJECT_NAME;
export const PROJECT_PATH = process.env.REACT_APP_PROJECT_PATH; export const PROJECT_PATH = process.env.REACT_APP_PROJECT_PATH;
export const ENDPOINT_ROOT = process.env.REACT_APP_ENDPOINT_ROOT;

View File

@ -1,4 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { ValidatorForm } from 'react-material-ui-form-validator';
import { ENDPOINT_ROOT } from '../constants/Env';
import SectionContent from '../components/SectionContent'; import SectionContent from '../components/SectionContent';
import { restComponent } from '../components/RestComponent'; import { restComponent } from '../components/RestComponent';
import LoadingNotification from '../components/LoadingNotification'; import LoadingNotification from '../components/LoadingNotification';
@ -7,9 +10,8 @@ import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography'; import Typography from '@material-ui/core/Typography';
import Slider from '@material-ui/core/Slider'; import Slider from '@material-ui/core/Slider';
import { makeStyles } from '@material-ui/core/styles'; import { makeStyles } from '@material-ui/core/styles';
import { ValidatorForm } from 'react-material-ui-form-validator';
export const DEMO_SETTINGS_ENDPOINT = process.env.REACT_APP_ENDPOINT_ROOT + "demoSettings"; export const DEMO_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "demoSettings";
const valueToPercentage = (value) => `${Math.round(value / 255 * 100)}%`; const valueToPercentage = (value) => `${Math.round(value / 255 * 100)}%`;