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.

38 lines
1.1 KiB

  1. import React, { Component } from 'react';
  2. import { NTP_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 NTPSettingsForm from '../forms/NTPSettingsForm';
  7. class NTPSettings extends Component {
  8. componentDidMount() {
  9. this.props.loadData();
  10. }
  11. render() {
  12. const { fetched, errorMessage, data, saveData, loadData, handleValueChange } = this.props;
  13. return (
  14. <SectionContent title="NTP Settings">
  15. <LoadingNotification
  16. onReset={loadData}
  17. fetched={fetched}
  18. errorMessage={errorMessage}
  19. render={() =>
  20. <NTPSettingsForm
  21. ntpSettings={data}
  22. onSubmit={saveData}
  23. onReset={loadData}
  24. handleValueChange={handleValueChange}
  25. />
  26. }
  27. />
  28. </SectionContent>
  29. )
  30. }
  31. }
  32. export default restComponent(NTP_SETTINGS_ENDPOINT, NTPSettings);