Mercurial > gemma
comparison client/src/components/Sidebar.vue @ 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 | d02d4e31491b |
children | 008bc1ae8897 |
comparison
equal
deleted
inserted
replaced
3667:c91bcb92e0b7 | 3668:3eb19b38446e |
---|---|
101 import { logOff } from "@/lib/session"; | 101 import { logOff } from "@/lib/session"; |
102 import { displayError } from "@/lib/errors"; | 102 import { displayError } from "@/lib/errors"; |
103 | 103 |
104 export default { | 104 export default { |
105 name: "sidebar", | 105 name: "sidebar", |
106 data() { | |
107 return { | |
108 notificationTimer: null | |
109 }; | |
110 }, | |
106 computed: { | 111 computed: { |
107 ...mapGetters("user", ["isSysAdmin", "isWaterwayAdmin"]), | 112 ...mapGetters("user", ["isSysAdmin", "isWaterwayAdmin"]), |
108 ...mapState("user", ["user", "roles", "isAuthenticated"]), | 113 ...mapState("user", ["user", "roles", "isAuthenticated"]), |
109 ...mapState("imports", ["stagingNotifications"]), | 114 ...mapState("imports", ["stagingNotifications"]), |
110 ...mapState("application", [ | 115 ...mapState("application", [ |
147 if (this.isWaterwayAdmin) { | 152 if (this.isWaterwayAdmin) { |
148 this.$store | 153 this.$store |
149 .dispatch("imports/loadStagingNotifications") | 154 .dispatch("imports/loadStagingNotifications") |
150 .then(() => { | 155 .then(() => { |
151 if (this.isAuthenticated) { | 156 if (this.isAuthenticated) { |
152 setTimeout(updateIndicators, 15000); | 157 this.notificationTimer = setTimeout(updateIndicators, 15000); |
153 } | 158 } |
154 }) | 159 }) |
155 .catch(error => { | 160 .catch(error => { |
156 const { status, data } = error.response; | 161 const { status, data } = error.response; |
157 displayError({ | 162 displayError({ |
159 message: `${status}: ${data.message || data}` | 164 message: `${status}: ${data.message || data}` |
160 }); | 165 }); |
161 }); | 166 }); |
162 } | 167 } |
163 }; | 168 }; |
164 setTimeout(updateIndicators, 15000); | 169 updateIndicators(); |
170 }, | |
171 destroyed() { | |
172 clearTimeout(this.notificationTimer); | |
165 } | 173 } |
166 }; | 174 }; |
167 </script> | 175 </script> |
168 | 176 |
169 <style lang="scss" scoped> | 177 <style lang="scss" scoped> |