From 2c732d3281b080c793bf75ec4e61fff06e8de48f Mon Sep 17 00:00:00 2001 From: "rjwats@gmail.com" Date: Sun, 4 Mar 2018 17:53:57 +0000 Subject: [PATCH] remove redundant code and refrences --- interface/src/containers/NTPSettings.js | 2 -- interface/src/containers/OTASettings.js | 2 -- interface/src/containers/WiFiSettings.js | 25 ++++------------ interface/src/forms/WiFiSettingsForm.js | 24 +++++++-------- interface/src/helpers/SimpleGet.js | 35 ---------------------- interface/src/helpers/SimplePost.js | 38 ------------------------ 6 files changed, 18 insertions(+), 108 deletions(-) delete mode 100644 interface/src/helpers/SimpleGet.js delete mode 100644 interface/src/helpers/SimplePost.js diff --git a/interface/src/containers/NTPSettings.js b/interface/src/containers/NTPSettings.js index 54af15a..2e291a9 100644 --- a/interface/src/containers/NTPSettings.js +++ b/interface/src/containers/NTPSettings.js @@ -4,8 +4,6 @@ import { NTP_SETTINGS_ENDPOINT } from '../constants/Endpoints'; import {restComponent} from '../components/RestComponent'; import SectionContent from '../components/SectionContent'; import NTPSettingsForm from '../forms/NTPSettingsForm'; -import { simpleGet } from '../helpers/SimpleGet'; -import { simplePost } from '../helpers/SimplePost'; class NTPSettings extends Component { diff --git a/interface/src/containers/OTASettings.js b/interface/src/containers/OTASettings.js index ebc1cc8..95be458 100644 --- a/interface/src/containers/OTASettings.js +++ b/interface/src/containers/OTASettings.js @@ -4,8 +4,6 @@ import { OTA_SETTINGS_ENDPOINT } from '../constants/Endpoints'; import {restComponent} from '../components/RestComponent'; import SectionContent from '../components/SectionContent'; import OTASettingsForm from '../forms/OTASettingsForm'; -import { simpleGet } from '../helpers/SimpleGet'; -import { simplePost } from '../helpers/SimplePost'; class OTASettings extends Component { diff --git a/interface/src/containers/WiFiSettings.js b/interface/src/containers/WiFiSettings.js index d561119..17f913c 100644 --- a/interface/src/containers/WiFiSettings.js +++ b/interface/src/containers/WiFiSettings.js @@ -5,24 +5,18 @@ import { WIFI_SETTINGS_ENDPOINT } from '../constants/Endpoints'; import { restComponent } from '../components/RestComponent'; import SectionContent from '../components/SectionContent'; import WiFiSettingsForm from '../forms/WiFiSettingsForm'; -import { simpleGet } from '../helpers/SimpleGet'; -import { simplePost } from '../helpers/SimplePost'; class WiFiSettings extends Component { constructor(props) { super(props); - this.state = { - selectedNetwork: null, - }; this.deselectNetworkAndLoadData = this.deselectNetworkAndLoadData.bind(this); - this.deselectNetwork = this.deselectNetwork.bind(this); } componentDidMount() { - const { selectedNetwork, deselectNetwork } = this.props; - if (selectedNetwork){ + const { selectedNetwork } = this.props; + if (selectedNetwork) { var wifiSettings = { ssid:selectedNetwork.ssid, password:"", @@ -30,25 +24,18 @@ class WiFiSettings extends Component { static_ip_config:false, } this.props.setData(wifiSettings); - this.setState({ selectedNetwork }); - deselectNetwork(); - }else { + } else { this.props.loadData(); } } deselectNetworkAndLoadData() { - this.deselectNetwork(); + this.props.deselectNetwork(); this.props.loadData(); } - deselectNetwork() { - this.setState({ selectedNetwork:null }); - } - render() { - const { selectedNetwork } = this.state; - const { data, fetched, errorMessage } = this.props; + const { data, fetched, errorMessage, selectedNetwork } = this.props; return ( + , - + , - + , - + , - + - ] + }