Mercurial > gemma
comparison client/src/components/Sidebar.vue @ 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 | 706121185e63 |
children | bb5286acfee2 |
comparison
equal
deleted
inserted
replaced
2456:194b42f28ea3 | 2457:374ee552ca85 |
---|---|
197 return ( | 197 return ( |
198 this.showContextBox && | 198 this.showContextBox && |
199 this.contextBoxContent === item && | 199 this.contextBoxContent === item && |
200 this.routeName == "mainview" | 200 this.routeName == "mainview" |
201 ); | 201 ); |
202 } | 202 }, |
203 }, | 203 updateIndicators() { |
204 mounted() { | |
205 setTimeout(() => { | |
206 this.$store.dispatch("imports/getStaging").catch(error => { | 204 this.$store.dispatch("imports/getStaging").catch(error => { |
207 const { status, data } = error.response; | 205 const { status, data } = error.response; |
208 displayError({ | 206 displayError({ |
209 title: "Backend Error", | 207 title: "Backend Error", |
210 message: `${status}: ${data.message || data}` | 208 message: `${status}: ${data.message || data}` |
211 }); | 209 }); |
212 }); | 210 }); |
213 }, 15000); | 211 } |
212 }, | |
213 mounted() { | |
214 this.updateIndicators(); | |
215 setTimeout(this.updateIndicators, 15000); | |
214 } | 216 } |
215 }; | 217 }; |
216 </script> | 218 </script> |
217 | 219 |
218 <style lang="scss" scoped> | 220 <style lang="scss" scoped> |