Set busy Spinner

This commit is contained in:
Kegan Dougal 2015-11-20 10:27:21 +00:00
parent f62312fbf3
commit 3075c97bae
1 changed files with 21 additions and 0 deletions

View File

@ -94,6 +94,10 @@ module.exports = React.createClass({
onFormSubmit: function(formVals) { onFormSubmit: function(formVals) {
var self = this; var self = this;
this.setState({
errorText: "",
busy: true
});
this.onProcessingRegistration(this.registerLogic.register(formVals)); this.onProcessingRegistration(this.registerLogic.register(formVals));
}, },
@ -122,12 +126,18 @@ module.exports = React.createClass({
identityServerUrl: self.registerLogic.getIdentityServerUrl(), identityServerUrl: self.registerLogic.getIdentityServerUrl(),
accessToken: response.access_token accessToken: response.access_token
}); });
self.setState({
busy: false
});
}, function(err) { }, function(err) {
if (err.message) { if (err.message) {
self.setState({ self.setState({
errorText: err.message errorText: err.message
}); });
} }
self.setState({
busy: false
});
console.log(err); console.log(err);
}); });
}, },
@ -158,6 +168,9 @@ module.exports = React.createClass({
this.registerLogic.tellStage("m.login.recaptcha", { this.registerLogic.tellStage("m.login.recaptcha", {
divId: divIdName divId: divIdName
}); });
this.setState({
busy: false // requires user input
});
}, },
// TODO: // TODO:
@ -211,11 +224,19 @@ module.exports = React.createClass({
console.error("Unknown register state: %s", currStep); console.error("Unknown register state: %s", currStep);
break; break;
} }
var busySpinner;
if (this.state.busy) {
var Spinner = sdk.getComponent("atoms.Spinner");
busySpinner = (
<Spinner />
);
}
return ( return (
<div> <div>
<h2>Create an account</h2> <h2>Create an account</h2>
{registerStep} {registerStep}
<div className="mx_Login_error">{this.state.errorText}</div> <div className="mx_Login_error">{this.state.errorText}</div>
{busySpinner}
<ServerConfig ref="serverConfig" <ServerConfig ref="serverConfig"
withToggleButton={true} withToggleButton={true}
defaultHsUrl={this.state.enteredHomeserverUrl} defaultHsUrl={this.state.enteredHomeserverUrl}