diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index a34bafe086..c63a0cfaca 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -1381,38 +1381,42 @@ module.exports = React.createClass({ ); } - // `ready` and `view==LOGGED_IN` may be set before `page_type` (because the - // latter is set via the dispatcher). If we don't yet have a `page_type`, - // keep showing the spinner for now. - if (this.state.view === VIEWS.LOGGED_IN && this.state.ready && this.state.page_type) { - /* for now, we stuff the entirety of our props and state into the LoggedInView. - * we should go through and figure out what we actually need to pass down, as well - * as using something like redux to avoid having a billion bits of state kicking around. - */ - const LoggedInView = sdk.getComponent('structures.LoggedInView'); - return ( - - ); - } else if (this.state.view === VIEWS.LOGGED_IN) { - // we think we are logged in, but are still waiting for the /sync to complete - const Spinner = sdk.getComponent('elements.Spinner'); - return ( -
- - - { _t('Logout') } - -
- ); - } else if (this.state.view == VIEWS.REGISTER) { + if (this.state.view === VIEWS.LOGGED_IN) { + // `ready` and `view==LOGGED_IN` may be set before `page_type` (because the + // latter is set via the dispatcher). If we don't yet have a `page_type`, + // keep showing the spinner for now. + if (this.state.ready && this.state.page_type) { + /* for now, we stuff the entirety of our props and state into the LoggedInView. + * we should go through and figure out what we actually need to pass down, as well + * as using something like redux to avoid having a billion bits of state kicking around. + */ + const LoggedInView = sdk.getComponent('structures.LoggedInView'); + return ( + + ); + } else { + // we think we are logged in, but are still waiting for the /sync to complete + const Spinner = sdk.getComponent('elements.Spinner'); + return ( +
+ + + { _t('Logout') } + +
+ ); + } + } + + if (this.state.view === VIEWS.REGISTER) { const Registration = sdk.getComponent('structures.login.Registration'); return ( ); - } else if (this.state.view == VIEWS.FORGOT_PASSWORD) { + } + + + if (this.state.view === VIEWS.FORGOT_PASSWORD) { const ForgotPassword = sdk.getComponent('structures.login.ForgotPassword'); return ( ); - } else { + } + + if (this.state.view === VIEWS.LOGIN) { const Login = sdk.getComponent('structures.login.Login'); return ( ); } + + throw new Error(`Unknown view ${this.state.view}`); }, });