Reset modes on login/logout

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2018-09-16 21:12:12 -07:00
parent 3c4d12c176
commit 4b3f484a89

View File

@ -452,7 +452,8 @@
observers: [ observers: [
"widthChanged(calcWidth)", "widthChanged(calcWidth)",
"modeChanged(mode)", "modeChanged(mode)",
"dateChanged(date)" "dateChanged(date)",
"userChanged(user)"
], ],
disableLogin: function(username, password) { disableLogin: function(username, password) {
@ -532,7 +533,9 @@
return; return;
} }
this.user = user; if (user && user.username) {
this.user = user;
}
}.bind(this), null, "POST", { u: this.username, p: this.password }); }.bind(this), null, "POST", { u: this.username, p: this.password });
}, },
@ -1144,8 +1147,11 @@
userChanged: function(user) { userChanged: function(user) {
this.resetPhotos(); this.resetPhotos();
if (user) { if (user) {
this.mode = "memories";
this._loadAlbums(); this._loadAlbums();
this._loadPhotos(); this._loadPhotos();
} else {
this.mode = "login";
} }
}, },
@ -1187,7 +1193,6 @@
if (results && results.username) { if (results && results.username) {
this.user = results; this.user = results;
this.mode = "memories";
} }
}.bind(this)); }.bind(this));