Mercurial > gemma
diff client/src/components/Sidebar.vue @ 3605:d02d4e31491b
sidebar: move staging notifications to store and update notifications after finishing review
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 05 Jun 2019 11:48:15 +0200 |
parents | 954f8b751fb0 |
children | 3eb19b38446e |
line wrap: on
line diff
--- a/client/src/components/Sidebar.vue Wed Jun 05 11:39:25 2019 +0200 +++ b/client/src/components/Sidebar.vue Wed Jun 05 11:48:15 2019 +0200 @@ -100,18 +100,13 @@ import { mapGetters, mapState } from "vuex"; import { logOff } from "@/lib/session"; import { displayError } from "@/lib/errors"; -import { HTTP } from "@/lib/http"; export default { name: "sidebar", - data() { - return { - stagingNotifications: null - }; - }, computed: { ...mapGetters("user", ["isSysAdmin", "isWaterwayAdmin"]), ...mapState("user", ["user", "roles", "isAuthenticated"]), + ...mapState("imports", ["stagingNotifications"]), ...mapState("application", [ "showSidebar", "showSearchbarLastState", @@ -150,12 +145,9 @@ mounted() { const updateIndicators = () => { if (this.isWaterwayAdmin) { - this.$store; - HTTP.get("/imports?states=pending&count=true", { - headers: { "X-Gemma-Auth": localStorage.getItem("token") } - }) - .then(response => { - this.stagingNotifications = response.data; + this.$store + .dispatch("imports/loadStagingNotifications") + .then(() => { if (this.isAuthenticated) { setTimeout(updateIndicators, 15000); }