login form

master
f0x 5 years ago
parent b8976f2ac4
commit 74af813e6b

@ -49,7 +49,7 @@ let login = create({
this.doLogin() this.doLogin()
}).catch((error) => { }).catch((error) => {
console.log("ERROR fetching homeserver url", error) console.log("ERROR fetching homeserver url", error)
let hsState = Object.assign(this.state.hs, {error: error, valid: false}) let hsState = Object.assign(this.state.hs, {error: error, valid: false, prompt: true})
this.setState({hs: hsState}) this.setState({hs: hsState})
}) })
}, },
@ -113,6 +113,7 @@ let login = create({
let formState = this.state.formState let formState = this.state.formState
formState.hs = e.target.value formState.hs = e.target.value
this.setState({formState: formState}) this.setState({formState: formState})
this.setState({hs: {error: null, valid: false, prompt: true, changed: true}})
}, },
render: function() { render: function() {
@ -141,7 +142,7 @@ let login = create({
<label htmlFor="hs" className={hsState}>Homeserver: </label> <label htmlFor="hs" className={hsState}>Homeserver: </label>
{this.state.hs.prompt ? ( {this.state.hs.prompt ? (
<> <>
<input type="text" id="hs" placeholder="https://lain.haus" value={this.state.formState["hs"]} onChange={this.handleHsChange}/> <input type="text" id="hs" value={this.state.formState["hs"]} onChange={this.handleHsChange}/>
</> </>
) : ( ) : (
<span id="hs">{this.state.formState["hs"]}</span> <span id="hs">{this.state.formState["hs"]}</span>

Loading…
Cancel
Save