changeset 2457:374ee552ca85

client: immediately load data for menu indicator I always forget that setInterval runs for first time _after_ the interval past, not immediately. So now the code is executed on mount and then in a 15s inteval.
author Markus Kottlaender <markus@intevation.de>
date Mon, 04 Mar 2019 07:46:53 +0100
parents 194b42f28ea3
children 204b0baac93c
files client/src/components/Sidebar.vue
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Sidebar.vue	Mon Mar 04 07:38:34 2019 +0100
+++ b/client/src/components/Sidebar.vue	Mon Mar 04 07:46:53 2019 +0100
@@ -199,10 +199,8 @@
         this.contextBoxContent === item &&
         this.routeName == "mainview"
       );
-    }
-  },
-  mounted() {
-    setTimeout(() => {
+    },
+    updateIndicators() {
       this.$store.dispatch("imports/getStaging").catch(error => {
         const { status, data } = error.response;
         displayError({
@@ -210,7 +208,11 @@
           message: `${status}: ${data.message || data}`
         });
       });
-    }, 15000);
+    }
+  },
+  mounted() {
+    this.updateIndicators();
+    setTimeout(this.updateIndicators, 15000);
   }
 };
 </script>