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-02-27 13:30:02 +0300
committerdartcafe <github@dartcafe.de>2021-02-27 13:30:02 +0300
commit79929fe6f86fb24a387b255390a6a20a77e61446 (patch)
tree16f5a9e33404b280e5aa49883695a85092c89f2f /src/js/views/Administration.vue
parent985fa6e5ebc878b00c64cd371079e45a491d2b58 (diff)
use async/await
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'src/js/views/Administration.vue')
-rw-r--r--src/js/views/Administration.vue56
1 files changed, 25 insertions, 31 deletions
diff --git a/src/js/views/Administration.vue b/src/js/views/Administration.vue
index d5e07825..8816a58e 100644
--- a/src/js/views/Administration.vue
+++ b/src/js/views/Administration.vue
@@ -187,41 +187,35 @@ export default {
this.deleteModal = true
},
- switchDeleted(pollId) {
- this.$store
- .dispatch('poll/switchDeleted', { pollId: pollId })
- .then(() => {
- emit('update-polls')
- })
- .catch(() => {
- showError(t('polls', 'Error switching deleted status.'))
- })
+ async switchDeleted(pollId) {
+ try {
+ await this.$store.dispatch('poll/switchDeleted', { pollId: pollId })
+ emit('update-polls')
+ } catch (e) {
+ showError(t('polls', 'Error switching deleted status.'))
+ }
},
- deletePermanently() {
- this.$store
- .dispatch('poll/delete', { pollId: this.deletePollId })
- .then(() => {
- emit('update-polls')
- this.deleteModal = false
- })
- .catch(() => {
- showError(t('polls', 'Error deleting poll.'))
- this.deleteModal = false
- })
+ async deletePermanently() {
+ try {
+ await this.$store.dispatch('poll/delete', { pollId: this.deletePollId })
+ emit('update-polls')
+ this.deleteModal = false
+ } catch (e) {
+ showError(t('polls', 'Error deleting poll.'))
+ this.deleteModal = false
+ }
},
- takeOver() {
- this.$store
- .dispatch('pollsAdmin/takeOver', { pollId: this.takeOverPollId })
- .then(() => {
- emit('update-polls')
- this.takeOverModal = false
- })
- .catch(() => {
- showError(t('polls', 'Error overtaking poll.'))
- this.takeOverModal = false
- })
+ async takeOver() {
+ try {
+ await this.$store.dispatch('pollsAdmin/takeOver', { pollId: this.takeOverPollId })
+ emit('update-polls')
+ this.takeOverModal = false
+ } catch (e) {
+ showError(t('polls', 'Error overtaking poll.'))
+ this.takeOverModal = false
+ }
},
refreshView() {