Make Lifecycle.loadSession return an explicit result

- rather than inferring it from the fact it didn't call logging_in.
This commit is contained in:
Richard van der Hoff 2017-06-16 12:20:52 +01:00
parent 5f689b7929
commit db3d9c0573
2 changed files with 13 additions and 21 deletions

View file

@ -335,10 +335,12 @@ module.exports = React.createClass({
});
}).catch((e) => {
console.error("Unable to load session", e);
}).then(()=>{
// stuff this through the dispatcher so that it happens
// after the on_logged_in action.
dis.dispatch({action: 'load_completed'});
return false;
}).then((loadedSession) => {
if (!loadedSession) {
// fall back to showing the login screen
dis.dispatch({action: "start_login"});
}
});
}).done();
},
@ -560,9 +562,6 @@ module.exports = React.createClass({
case 'will_start_client':
this._onWillStartClient();
break;
case 'load_completed':
this._onLoadCompleted();
break;
case 'new_version':
this.onVersion(
payload.currentVersion, payload.newVersion,
@ -892,17 +891,6 @@ module.exports = React.createClass({
});
},
/**
* Called when the sessionloader has finished
*/
_onLoadCompleted: function() {
// if we've got this far without leaving the 'loading' view, then
// login must have failed, so start the login process
if (this.state.view === VIEWS.LOADING) {
dis.dispatch({action: "start_login"});
}
},
/**
* Called whenever someone changes the theme
*