diff --git a/app/src/components/Admin.js b/app/src/components/Admin.js
index 14198e80..58843847 100644
--- a/app/src/components/Admin.js
+++ b/app/src/components/Admin.js
@@ -8,7 +8,6 @@ import {
Form,
Header,
Icon,
- Input,
Loader,
Modal,
Placeholder,
@@ -60,8 +59,7 @@ class Settings extends React.Component {
}
this.handleSubmit = this.handleSubmit.bind(this);
- this.toggleQRCode = this.toggleQRCode.bind(this);
- this.handleHotspotPasswordChange = this.handleHotspotPasswordChange.bind(this);
+ this.handleHotspotChange = this.handleHotspotChange.bind(this);
}
async componentDidMount() {
@@ -77,7 +75,7 @@ class Settings extends React.Component {
throttle_on_startup: settings.throttle_on_startup,
throttle_status: settings.throttle_status,
timezone: {value: settings.timezone, label: settings.timezone},
- }, this.handleHotspotPasswordChange);
+ }, this.handleHotspotChange);
}
async handleSubmit(e) {
@@ -93,29 +91,18 @@ class Settings extends React.Component {
await saveSettings(settings);
}
- handleTimezoneChange = async (timezone) => {
- this.setState({timezone: timezone});
- }
-
handleInputChange = async (e, name, value) => {
- e.preventDefault();
+ if (e) {e.preventDefault()}
this.setState({[name]: value});
}
- handleHotspotPasswordChange = async () => {
+ handleHotspotChange = async () => {
let {hotspot_ssid, hotspot_encryption, hotspot_password} = this.state;
// Special string which allows a mobile device to connect to a specific Wi-Fi.
let qrCodeValue = `WIFI:S:${hotspot_ssid};T:${hotspot_encryption};P:${hotspot_password};;`;
this.setState({qrCodeValue});
}
- toggleQRCode(e) {
- if (e !== undefined) {
- e.preventDefault();
- }
- this.setState({qrOpen: !this.state.qrOpen});
- }
-
render() {
if (this.state.ready === false) {
return