Skip to content

Commit 6fc910a

Browse files
committed
Don't try to set page_type if not logged in
1 parent 959c0f0 commit 6fc910a

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎src/controllers/pages/MatrixChat.js‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,19 @@ module.exports = {
4040
},
4141

4242
getInitialState: function() {
43-
return {
43+
var s = {
4444
logged_in: !!(MatrixClientPeg.get() && MatrixClientPeg.get().credentials),
4545
ready: false,
46-
page_type: MatrixClientPeg.get().getRooms().length ? this.PageTypes.RoomView : this.PageTypes.RoomDirectory,
4746
aux_panel: null,
4847
};
48+
if (s.logged_in) {
49+
if (MatrixClientPeg.get().getRooms().length) {
50+
s.page_type = this.PageTypes.RoomView;
51+
} else {
52+
s.page_type = this.PageTypes.RoomDirectory;
53+
}
54+
}
55+
return s;
4956
},
5057

5158
componentDidMount: function() {

0 commit comments

Comments
 (0)