diff options
Diffstat (limited to 'packages/client')
| -rw-r--r-- | packages/client/src/components/poll.vue | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/packages/client/src/components/poll.vue b/packages/client/src/components/poll.vue index 6dbe0c84e9..20a9900258 100644 --- a/packages/client/src/components/poll.vue +++ b/packages/client/src/components/poll.vue @@ -87,14 +87,20 @@ export default defineComponent({ toggleShowResult() { this.showResult = !this.showResult; }, - vote(id) { + async vote(id) { if (this.readOnly || this.closed || !this.poll.multiple && this.poll.choices.some(c => c.isVoted)) return; - os.api('notes/polls/vote', { + + const { canceled } = await os.confirm({ + type: 'question', + text: this.$t('voteConfirm', { choice: this.poll.choices[id].text }), + }); + if (canceled) return; + + await os.api('notes/polls/vote', { noteId: this.note.id, choice: id - }).then(() => { - if (!this.showResult) this.showResult = !this.poll.multiple; }); + if (!this.showResult) this.showResult = !this.poll.multiple; } } }); |