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:
authordartcafe <github@dartcafe.de>2021-01-10 23:28:11 +0300
committerdartcafe <github@dartcafe.de>2021-01-11 00:43:46 +0300
commit98feeb300ebd1a46c3bc4a9a7fd4c6d82a247d9b (patch)
tree1a8d91ee23e5c4e5c885e59d15ef993ca60270b2 /src/js/views
parentc8a5e72cdd7451347011b83a320ec21a8ce927b4 (diff)
refactoring, optimization, tidy
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'src/js/views')
-rw-r--r--src/js/views/PollList.vue18
-rw-r--r--src/js/views/Vote.vue60
2 files changed, 23 insertions, 55 deletions
diff --git a/src/js/views/PollList.vue b/src/js/views/PollList.vue
index dcca1fcd..841447bb 100644
--- a/src/js/views/PollList.vue
+++ b/src/js/views/PollList.vue
@@ -239,34 +239,34 @@ export default {
switchDeleted(pollId) {
this.$store
.dispatch('poll/switchDeleted', { pollId: pollId })
- .then(() => {
- emit('update-polls')
- })
.catch(() => {
showError(t('polls', 'Error deleting poll.'))
})
+ .finally(() => {
+ emit('update-polls')
+ })
},
deletePermanently(pollId) {
this.$store
.dispatch('poll/delete', { pollId: pollId })
- .then(() => {
- emit('update-polls')
- })
.catch(() => {
showError(t('polls', 'Error deleting poll.'))
})
+ .finally(() => {
+ emit('update-polls')
+ })
},
clonePoll(pollId) {
this.$store
.dispatch('poll/clone', { pollId: pollId })
- .then(() => {
- emit('update-polls')
- })
.catch(() => {
showError(t('polls', 'Error cloning poll.'))
})
+ .finally(() => {
+ emit('update-polls')
+ })
},
},
}
diff --git a/src/js/views/Vote.vue b/src/js/views/Vote.vue
index 80ff991b..0437490a 100644
--- a/src/js/views/Vote.vue
+++ b/src/js/views/Vote.vue
@@ -128,10 +128,10 @@ export default {
data() {
return {
- reloadInterval: 30000,
+ // reloadInterval: 30000,
voteSaved: false,
delay: 50,
- isLoading: true,
+ isLoading: false,
ranked: false,
manualViewDatePoll: '',
manualViewTextPoll: '',
@@ -143,7 +143,7 @@ export default {
poll: state => state.poll,
acl: state => state.poll.acl,
options: state => state.poll.options.list,
- share: state => state.poll.share,
+ share: state => state.share,
settings: state => state.settings,
}),
@@ -195,10 +195,6 @@ export default {
return t('polls', 'Polls') + ' - ' + this.poll.title
},
- // dateExpiryString() {
- // return moment.unix(this.poll.expire).format('LLLL')
- // },
- //
timeExpirationRelative() {
if (this.poll.expire) {
return moment.unix(this.poll.expire).fromNow()
@@ -274,16 +270,10 @@ export default {
},
- watch: {
- $route() {
- this.loadPoll()
- },
- },
-
created() {
- if (getCurrentUser() && this.$route.params.token) {
+ if (getCurrentUser() && this.$route.name === 'publicVote') {
// reroute to the internal vote page, if the user is logged in
- this.$store.dispatch('poll/share/get', { token: this.$route.params.token })
+ this.$store.dispatch('share/get', { token: this.$route.params.token })
.then((response) => {
this.$router.replace({ name: 'vote', params: { id: response.share.pollId } })
})
@@ -291,15 +281,14 @@ export default {
this.$router.replace({ name: 'notfound' })
})
} else {
- this.loadPoll()
emit('toggle-sidebar', { open: (window.innerWidth > 920) })
}
- this.timedReload()
+ // this.timedReload()
},
beforeDestroy() {
this.$store.dispatch({ type: 'poll/reset' })
- window.clearInterval(this.reloadTimer)
+ // window.clearInterval(this.reloadTimer)
},
methods: {
@@ -307,12 +296,12 @@ 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)
- },
+ // timedReload() {
+ // // reload poll list periodically
+ // this.reloadTimer = window.setInterval(() => {
+ // emit('load-poll', true)
+ // }, this.reloadInterval)
+ // },
getNextViewMode() {
if (this.settings.viewModes.indexOf(this.viewMode) < 0) {
@@ -322,16 +311,12 @@ export default {
}
},
- openConfiguration() {
- emit('toggle-sidebar', { open: true, activeTab: 'configuration' })
- },
-
toggleSideBar() {
emit('toggle-sidebar')
},
toggleView() {
- emit('transitions-off', { delay: 500 })
+ emit('transitions-off', 500)
if (this.poll.type === 'datePoll') {
if (this.manualViewDatePoll) {
this.manualViewDatePoll = ''
@@ -346,23 +331,6 @@ export default {
}
}
},
-
- loadPoll() {
- this.isLoading = true
- emit('transitions-off')
- this.$store
- .dispatch({ type: 'poll/get', pollId: this.$route.params.id, token: this.$route.params.token })
- .then((response) => {
- this.isLoading = false
- emit('transitions-off', 500)
- window.document.title = this.windowTitle
- })
- .catch(() => {
- this.isLoading = false
- emit('transitions-off', 500)
- this.$router.replace({ name: 'notfound' })
- })
- },
},
}
</script>