changeset 2676:906e9a13592f

sidebar: only update staging info for appropriate usergroups
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 15 Mar 2019 11:14:21 +0100
parents b219ca1514f4
children b7995ab49ec5 a3cab473304d
files client/src/components/Sidebar.vue
diffstat 1 files changed, 16 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Sidebar.vue	Fri Mar 15 09:34:06 2019 +0100
+++ b/client/src/components/Sidebar.vue	Fri Mar 15 11:14:21 2019 +0100
@@ -166,7 +166,7 @@
   },
   computed: {
     ...mapGetters("user", ["isSysAdmin", "isWaterwayAdmin"]),
-    ...mapState("user", ["user"]),
+    ...mapState("user", ["user", "roles"]),
     ...mapState("application", [
       "showSidebar",
       "showSearchbarLastState",
@@ -202,21 +202,23 @@
       );
     },
     updateIndicators() {
-      this.$store;
-      HTTP.get("/imports?states=pending", {
-        headers: { "X-Gemma-Auth": localStorage.getItem("token") }
-      })
-        .then(response => {
-          const { imports } = response.data;
-          this.stagingNotifications = imports.length;
+      if (this.isWaterwayAdmin) {
+        this.$store;
+        HTTP.get("/imports?states=pending", {
+          headers: { "X-Gemma-Auth": localStorage.getItem("token") }
         })
-        .catch(error => {
-          const { status, data } = error.response;
-          displayError({
-            title: "Backend Error",
-            message: `${status}: ${data.message || data}`
+          .then(response => {
+            const { imports } = response.data;
+            this.stagingNotifications = imports.length;
+          })
+          .catch(error => {
+            const { status, data } = error.response;
+            displayError({
+              title: "Backend Error",
+              message: `${status}: ${data.message || data}`
+            });
           });
-        });
+      }
     }
   },
   mounted() {