import React, { Component } from 'react'; import { ValidatorForm } from 'react-material-ui-form-validator'; import { Typography, Box, Checkbox } from '@material-ui/core'; import SaveIcon from '@material-ui/icons/Save'; import { ENDPOINT_ROOT } from '../api'; import { restController, RestControllerProps, RestFormLoader, RestFormProps, FormActions, FormButton, SectionContent, BlockFormControlLabel } from '../components'; import { LightState } from './types'; export const LIGHT_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "lightState"; type LightStateRestControllerProps = RestControllerProps; class LightStateRestController extends Component { componentDidMount() { this.props.loadData(); } render() { return ( ( )} /> ) } } export default restController(LIGHT_SETTINGS_ENDPOINT, LightStateRestController); type LightStateRestControllerFormProps = RestFormProps; function LightStateRestControllerForm(props: LightStateRestControllerFormProps) { const { data, saveData, loadData, handleValueChange } = props; return ( The form below controls the LED via the RESTful service exposed by the ESP device. } label="LED State?" /> } variant="contained" color="primary" type="submit"> Save Reset ); }