From a6ab1074dcd1a456452bd359572dde28d31e8bb7 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Sun, 16 Sep 2018 21:19:56 -0700 Subject: [PATCH] You can now hit LOGOUT while photos are loading Signed-off-by: James Ketrenos --- frontend/src/ketr-photos/ketr-photos.html | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/src/ketr-photos/ketr-photos.html b/frontend/src/ketr-photos/ketr-photos.html index 44c3fb2..cb31859 100755 --- a/frontend/src/ketr-photos/ketr-photos.html +++ b/frontend/src/ketr-photos/ketr-photos.html @@ -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();