Skip to content
Snippets Groups Projects
Commit 561b0fc1 authored by syuilo's avatar syuilo
Browse files

feat(client): show confirm dialog when vote

parent b8f42fca
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@
### Improvements
- API: /antennas/notes API で日付による絞り込みができるように
- クライアント: アンケートに投票する際に確認ダイアログを出すように
### Bugfixes
- クライアント: ログインにおいてパスワードが誤っている際のエラーメッセージが正しく表示されない問題を修正
......
......@@ -809,6 +809,7 @@ ffVisibilityDescription: "自分のフォロー/フォロワー情報の公開
continueThread: "さらにスレッドを見る"
deleteAccountConfirm: "アカウントが削除されます。よろしいですか?"
incorrectPassword: "パスワードが間違っています。"
voteConfirm: "「{choice}」に投票しますか?"
_emailUnavailable:
used: "既に使用されています"
......
......@@ -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;
}
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment