# HG changeset patch # User Thomas Junk # Date 1553255153 -3600 # Node ID 6c1c4f55d99b7e930b0675581b5207a36cfc7c87 # Parent eb1b7479c5e3c7d7c7a7b0371b5c98ab7856944a sidebar: only update when user is logged in diff -r eb1b7479c5e3 -r 6c1c4f55d99b client/src/components/Sidebar.vue --- a/client/src/components/Sidebar.vue Fri Mar 22 11:47:28 2019 +0100 +++ b/client/src/components/Sidebar.vue Fri Mar 22 12:45:53 2019 +0100 @@ -166,7 +166,7 @@ }, computed: { ...mapGetters("user", ["isSysAdmin", "isWaterwayAdmin"]), - ...mapState("user", ["user", "roles"]), + ...mapState("user", ["user", "roles", "isAuthenticated"]), ...mapState("application", [ "showSidebar", "showSearchbarLastState", @@ -200,8 +200,10 @@ this.contextBoxContent === item && this.routeName == "mainview" ); - }, - updateIndicators() { + } + }, + mounted() { + const updateIndicators = () => { if (this.isWaterwayAdmin) { this.$store; HTTP.get("/imports?states=pending&count=true", { @@ -209,6 +211,9 @@ }) .then(response => { this.stagingNotifications = response.data; + if (this.isAuthenticated) { + setTimeout(updateIndicators, 15000); + } }) .catch(error => { const { status, data } = error.response; @@ -218,11 +223,8 @@ }); }); } - } - }, - mounted() { - this.updateIndicators(); - setInterval(this.updateIndicators, 15000); + }; + setTimeout(updateIndicators, 15000); } };