changeset 3668:3eb19b38446e

client: avoid requesting number of pending imports after logging out
author Markus Kottlaender <markus@intevation.de>
date Mon, 17 Jun 2019 11:08:03 +0200
parents c91bcb92e0b7
children 9b02c0b00d7b
files client/src/components/Sidebar.vue
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Sidebar.vue	Mon Jun 17 11:00:21 2019 +0200
+++ b/client/src/components/Sidebar.vue	Mon Jun 17 11:08:03 2019 +0200
@@ -103,6 +103,11 @@
 
 export default {
   name: "sidebar",
+  data() {
+    return {
+      notificationTimer: null
+    };
+  },
   computed: {
     ...mapGetters("user", ["isSysAdmin", "isWaterwayAdmin"]),
     ...mapState("user", ["user", "roles", "isAuthenticated"]),
@@ -149,7 +154,7 @@
           .dispatch("imports/loadStagingNotifications")
           .then(() => {
             if (this.isAuthenticated) {
-              setTimeout(updateIndicators, 15000);
+              this.notificationTimer = setTimeout(updateIndicators, 15000);
             }
           })
           .catch(error => {
@@ -161,7 +166,10 @@
           });
       }
     };
-    setTimeout(updateIndicators, 15000);
+    updateIndicators();
+  },
+  destroyed() {
+    clearTimeout(this.notificationTimer);
   }
 };
 </script>