Don't try to set page_type if not logged in
parent
959c0f0669
commit
6fc910a259
|
@ -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() {
|
||||||
|
|
Loading…
Reference in New Issue