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>2020-06-20 12:38:34 +0300
committerdartcafe <github@dartcafe.de>2020-06-20 12:38:34 +0300
commitd3b8c7c7028b6c112c230df6c010263dfb1a1130 (patch)
tree29e63adc08d02a4fc1b6eb32c01c72046444fc5b /src/js/components/Create/CreateDlg.vue
parentb1c1a707d1b5523868d992b96a4ccddd1086ef2b (diff)
Completed API with poll
Diffstat (limited to 'src/js/components/Create/CreateDlg.vue')
-rw-r--r--src/js/components/Create/CreateDlg.vue24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/js/components/Create/CreateDlg.vue b/src/js/components/Create/CreateDlg.vue
index 10c387fd..5cd03f30 100644
--- a/src/js/components/Create/CreateDlg.vue
+++ b/src/js/components/Create/CreateDlg.vue
@@ -62,7 +62,7 @@
</template>
<script>
-import { mapState, mapMutations, mapActions } from 'vuex'
+import { mapState } from 'vuex'
import { emit } from '@nextcloud/event-bus'
import ConfigBox from '../Base/ConfigBox'
@@ -92,14 +92,6 @@ export default {
},
methods: {
- ...mapMutations({
- setPollProperty: 'poll/setProperty',
- }),
-
- ...mapActions({
- resetPoll: 'poll/reset',
- }),
-
cancel() {
this.title = ''
this.type = 'datePoll'
@@ -107,19 +99,15 @@ export default {
},
confirm() {
- this.resetPoll()
- this.setPollProperty({ id: 0 })
- this.setPollProperty({ title: this.title })
- this.setPollProperty({ type: this.type })
- this.$store.dispatch('poll/write')
- .then(() => {
+ this.$store.dispatch('poll/add', { title: this.title, type: this.type })
+ .then((response) => {
emit('update-polls')
this.cancel()
- OC.Notification.showTemporary(t('polls', 'Poll "%n" added', 1, this.poll.title), { type: 'success' })
- this.$router.push({ name: 'vote', params: { id: this.poll.id } })
+ OC.Notification.showTemporary(t('polls', 'Poll "%n" added', 1, response.data.id), { type: 'success' })
+ this.$router.push({ name: 'vote', params: { id: response.data.id } })
})
.catch(() => {
- OC.Notification.showTemporary(t('polls', 'Error while creating Poll "%n"', 1, this.poll.title), { type: 'error' })
+ OC.Notification.showTemporary(t('polls', 'Error while creating Poll "%n"', 1, this.title), { type: 'error' })
})
},