-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (32 loc) · 1.04 KB
/
index.js
File metadata and controls
35 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import './style'
import { Component } from 'preact'
import Registration from './components/registration'
const Spinner = props => <div>{props.on ? <svg className='spinner' viewBox='0 0 50 50'><circle className='path' cx='25' cy='25' r='20' fill='none' stroke-width='5'></circle></svg> : null}</div>
const configUpdate = config =>
fetch(API_PREFIX + '/config', {
method : 'POST',
headers : {
'Accept' : 'application/json',
'Content-Type' : 'application/json'
},
body : JSON.stringify({ carConnection : { ssid : config.wifi.ssid, password : config.wifi.password, host : config.host, port : config.port}})
}).then(response => response.ok)
export default class App extends Component {
constructor() {
super()
this.state.spinner = false
this.setSpinner = this.setSpinner.bind(this)
console.log('test')
}
setSpinner(on) {
this.setState({ spinner :on })
}
render() {
return (
<div className="container">
<Spinner on={this.state.spinner}></Spinner>
<Registration spinner={this.setSpinner} ></Registration>
</div>
)
}
}