From eb4d7f04e79fb4ecea156eb83edb94919b53519f Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 30 Jan 2017 16:23:52 +0000 Subject: [PATCH] Use busy spinner when requesting teams --- src/components/structures/login/Registration.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/structures/login/Registration.js b/src/components/structures/login/Registration.js index f1085f2e07..1456b666f4 100644 --- a/src/components/structures/login/Registration.js +++ b/src/components/structures/login/Registration.js @@ -67,6 +67,7 @@ module.exports = React.createClass({ getInitialState: function() { return { busy: false, + teamServerBusy: false, errorText: null, // We remember the values entered by the user because // the registration form will be unmounted during the @@ -104,8 +105,11 @@ module.exports = React.createClass({ ) { this._rtsClient = new RtsClient(this.props.teamServerConfig.teamServerURL); + this.setState({ + teamServerBusy: true, + }); // GET team configurations including domains, names and icons - this._rtsClient.getTeamsConfig().done((args) => { + this._rtsClient.getTeamsConfig().then((args) => { // args = [$request, $body] const teamsConfig = { teams: args[1], @@ -117,6 +121,10 @@ module.exports = React.createClass({ }); }, (err) => { console.error('Error retrieving config for teams', err); + }).finally(() => { + this.setState({ + teamServerBusy: false, + }); }); } }, @@ -299,6 +307,8 @@ module.exports = React.createClass({ }, _getRegisterContentJsx: function() { + var Spinner = sdk.getComponent("elements.Spinner"); + var currStep = this.registerLogic.getStep(); var registerStep; switch (currStep) { @@ -308,6 +318,10 @@ module.exports = React.createClass({ case "Register.STEP_m.login.dummy": // NB. Our 'username' prop is specifically for upgrading // a guest account + if (this.state.teamServerBusy) { + registerStep = ; + break; + } registerStep = (