Commit 34ba6e7d authored by Mark Repka's avatar Mark Repka

Minor fixes, dumb stuff

parent e51c5890
This diff is collapsed.
......@@ -6,10 +6,10 @@ class App extends Component {
constructor() {
super();
this.state = { data: [], clientid: "legacy", availableClients: ["legacy"] };
this.state = { data: [], clientid: null, availableClients: ["legacy"] };
this.getTempClients();
this.startUpdateChart(this.state.clientid);
//this.startUpdateChart(this.state.clientid);
this.setClientId = this.handleSetClientId.bind(this);
}
......@@ -40,20 +40,18 @@ class App extends Component {
fetch("https://api.repkam09.com/api/temp/clients").then((res) => {
return res.json();
}).then((jsonres) => {
self.setState({ availableClients: jsonres });
console.log("Got " + jsonres.length + " results, first result: " + jsonres[0]);
self.setState({ availableClients: jsonres, clientid: jsonres[0] });
self.startUpdateChart(jsonres[0]);
});
}
render() {
let picker = null;
if (this.state.availableClients.length > 1) {
const options = this.state.availableClients.map((client) => {
if (client === "legacy") {
return <option value={client}>Huot House</option>
} else {
return <option value={client}>{client}</option>
}
if (this.state.availableClients.length > 0) {
const options = this.state.availableClients.map((client, index) => {
return <option value={client} key={index}>{client}</option>
});
picker = (
<select name="cars" onChange={this.setClientId}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment