Skip to content

Commit 9851370

Browse files
authored
Merge pull request #542 from dev-protocol/feature/fix-voting
Feature/fix voting
2 parents 398aeaa + 5ee565b commit 9851370

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/components/Voting/Form.vue

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
33
import {
44
onPostCreated,
5-
onUpdate,
5+
onSetup,
66
} from '@devprotocol/clubs-plugin-posts/plugin-helper'
77
import type { Poll } from '../../types.ts'
88
import { Strings } from '../i18n'
@@ -11,21 +11,9 @@ import { i18nFactory } from '@devprotocol/clubs-core'
1111
const i18nBase = i18nFactory(Strings)
1212
let i18n = ref<ReturnType<typeof i18nBase>>(i18nBase(['en']))
1313
14-
type Choice = {
15-
id: number
16-
message: string | undefined
17-
}
18-
19-
// Choiceにvotesを追加
20-
type ChoiceWithVotes = Choice & {
21-
votes: number
22-
}
23-
24-
onUpdate((post) => {
25-
// optionsのpollにundefinedがある場合はreturnする
26-
if (options.value.some((option) => option.poll === undefined)) {
27-
return post
28-
}
14+
onSetup((post) => {
15+
// Remove options that have not been filled in
16+
options.value = options.value.filter((option) => option.poll !== undefined)
2917
3018
const poll: Poll = {
3119
options: options.value.map((option) => {

0 commit comments

Comments
 (0)