Don't try to set page_type if not logged in

This commit is contained in:
David Baker 2015-07-21 11:12:59 -07:00
parent 959c0f0669
commit 6fc910a259

View file

@ -40,12 +40,19 @@ module.exports = {
}, },
getInitialState: function() { getInitialState: function() {
return { var s = {
logged_in: !!(MatrixClientPeg.get() && MatrixClientPeg.get().credentials), logged_in: !!(MatrixClientPeg.get() && MatrixClientPeg.get().credentials),
ready: false, ready: false,
page_type: MatrixClientPeg.get().getRooms().length ? this.PageTypes.RoomView : this.PageTypes.RoomDirectory,
aux_panel: null, aux_panel: null,
}; };
if (s.logged_in) {
if (MatrixClientPeg.get().getRooms().length) {
s.page_type = this.PageTypes.RoomView;
} else {
s.page_type = this.PageTypes.RoomDirectory;
}
}
return s;
}, },
componentDidMount: function() { componentDidMount: function() {