Fork of the excellent esp8266-react - https://github.com/rjwats/esp8266-react
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.1 KiB

  1. import React, { Component } from 'react';
  2. import { OTA_SETTINGS_ENDPOINT } from '../constants/Endpoints';
  3. import { restComponent } from '../components/RestComponent';
  4. import LoadingNotification from '../components/LoadingNotification';
  5. import SectionContent from '../components/SectionContent';
  6. import OTASettingsForm from '../forms/OTASettingsForm';
  7. class OTASettings extends Component {
  8. componentDidMount() {
  9. this.props.loadData();
  10. }
  11. render() {
  12. const { fetched, errorMessage, data, saveData, loadData, handleValueChange, handleCheckboxChange } = this.props;
  13. return (
  14. <SectionContent title="OTA Settings">
  15. <LoadingNotification
  16. onReset={loadData}
  17. fetched={fetched}
  18. errorMessage={errorMessage}>
  19. <OTASettingsForm
  20. otaSettings={data}
  21. onSubmit={saveData}
  22. onReset={loadData}
  23. handleValueChange={handleValueChange}
  24. handleCheckboxChange={handleCheckboxChange}
  25. />
  26. </LoadingNotification>
  27. </SectionContent>
  28. )
  29. }
  30. }
  31. export default restComponent(OTA_SETTINGS_ENDPOINT, OTASettings);