Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Gieling <github@dartcafe.de>2021-01-03 01:04:43 +0300
committerGitHub <noreply@github.com>2021-01-03 01:04:43 +0300
commit0e3cfe92bab07a101cfb2d6a2591531bb1740050 (patch)
tree8fe34c674ec786c87eafd2360166850a693d794c /src/js/views/Vote.vue
parent5a76364c53a268b721e26f36ff626dd84e78a4bf (diff)
parent5518cfd715975cbce1fa6c58f15cd447f411d521 (diff)
Merge pull request #1302 from nextcloud/auto-refresh-poll
timed poll updates
Diffstat (limited to 'src/js/views/Vote.vue')
-rw-r--r--src/js/views/Vote.vue10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/js/views/Vote.vue b/src/js/views/Vote.vue
index 9ec2c85e..80ff991b 100644
--- a/src/js/views/Vote.vue
+++ b/src/js/views/Vote.vue
@@ -128,6 +128,7 @@ export default {
data() {
return {
+ reloadInterval: 30000,
voteSaved: false,
delay: 50,
isLoading: true,
@@ -293,10 +294,12 @@ export default {
this.loadPoll()
emit('toggle-sidebar', { open: (window.innerWidth > 920) })
}
+ this.timedReload()
},
beforeDestroy() {
this.$store.dispatch({ type: 'poll/reset' })
+ window.clearInterval(this.reloadTimer)
},
methods: {
@@ -304,6 +307,13 @@ export default {
emit('toggle-sidebar', { open: true, activeTab: 'options' })
},
+ timedReload() {
+ // reload poll list periodically
+ this.reloadTimer = window.setInterval(() => {
+ this.$store.dispatch({ type: 'poll/get', pollId: this.$route.params.id, token: this.$route.params.token })
+ }, this.reloadInterval)
+ },
+
getNextViewMode() {
if (this.settings.viewModes.indexOf(this.viewMode) < 0) {
return this.settings.viewModes[1]