This commit is contained in:
dartcafe 2020-12-19 22:24:24 +01:00
Родитель be36c90515
Коммит 5518cfd715
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CCE73CEF3035D3C8
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -128,6 +128,7 @@ export default {
data() {
return {
reloadInterval: 30000,
voteSaved: false,
delay: 50,
isLoading: true,
@ -268,10 +269,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: {
@ -279,6 +282,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]