'use strict'; import React from 'react'; export default class DetailsStep extends React.Component { constructor (props) { super(props); this.state = { ota: false, ssl: false }; } handleOtaCheckbox (e) { this.setState({ ota: e.target.checked }); } handleSslCheckbox (e) { this.setState({ ssl: e.target.checked }); } handleFormSubmit (e) { e.preventDefault(); let otaCreds = {}; otaCreds.enabled = false; if (this.state.ota) { otaCreds.enabled = true; otaCreds.host = this.refs.host.value; otaCreds.port = parseInt(this.refs.port.value, 10); otaCreds.ssl = false; if (this.state.ssl) { otaCreds.ssl = true; if (this.refs.fingerprint.value !== '') otaCreds['fingerprint'] = this.refs.fingerprint.value; } otaCreds.path = this.refs.path.value; } this.props.setName(this.refs.name.value); if (this.refs.deviceId.value !== '') this.props.setDeviceId(this.refs.deviceId.value); this.props.setOtaCreds(otaCreds); this.props.nextStep(); } render () { return (
A few details before finishing the configuration.