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.

36 lines
1.0 KiB

  1. import React, { Component } from 'react';
  2. import { AP_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 APSettingsForm from '../forms/APSettingsForm';
  7. class APSettings 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="AP Settings">
  15. <LoadingNotification
  16. onReset={loadData}
  17. fetched={fetched}
  18. errorMessage={errorMessage}>
  19. <APSettingsForm
  20. apSettings={data}
  21. onSubmit={saveData}
  22. onReset={loadData}
  23. handleValueChange={handleValueChange}
  24. />
  25. </LoadingNotification>
  26. </SectionContent>
  27. )
  28. }
  29. }
  30. export default restComponent(AP_SETTINGS_ENDPOINT, APSettings);