You can now hit LOGOUT while photos are loading

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2018-09-16 21:19:56 -07:00
parent 626295c94c
commit a6ab1074dc

View File

@ -540,12 +540,7 @@
},
logout: function(event) {
if (this.loading) {
return;
}
this.loading = true;
window.fetch("api/v1/users/logout", function(error, xhr) {
this.loading = false;
this.user = null;
}.bind(this));
},
@ -1051,6 +1046,10 @@
window.fetch("api/v1/photos" + path + query, function(path, error, xhr) {
this.loading = false;
if (!this.user) {
return;
}
if ((mode != this.mode) ||
((mode == "albums") && (path != (this.path || ""))) ||
((mode == "memories") && (path != ("/memories/" + (this.date || ""))))) {
@ -1104,6 +1103,11 @@
var path = this.path || "";
window.fetch("api/v1/albums" + path, function(path, error, xhr) {
this.loadingAlbums = false;
if (!this.user) {
return;
}
if (path != (this.path || "")) {
console.log("Skipping results for old query. Triggering re-fetch of albums for new path.");
this._loadAlbums();