@@ -29,6 +29,8 @@ import type {
2929 AllowProposals ,
3030 PollStore ,
3131 PollTypesType ,
32+ VotingVariant ,
33+ VotingVariantsType
3234} from './poll.types'
3335import type { ViewMode } from './preferences.types'
3436
@@ -45,7 +47,16 @@ export const pollTypes: Record<PollType, PollTypesType> = {
4547 } ,
4648}
4749
48- const DEFAULT_CHOSEN_RANK = [ ] ;
50+ export const votingVariants : Record < VotingVariant , VotingVariantsType > = {
51+ simple : {
52+ name : t ( 'polls' , 'Simple variant' ) ,
53+ } ,
54+ generic : {
55+ name : t ( 'polls' , 'Generic variant' ) ,
56+ }
57+ }
58+
59+ const DEFAULT_CHOSEN_RANK : Array < string > = [ ] ;
4960
5061export const usePollStore = defineStore ( 'poll' , {
5162 state : ( ) : PollStore => ( {
@@ -59,10 +70,10 @@ export const usePollStore = defineStore('poll', {
5970 access : 'private' ,
6071 allowComment : false ,
6172 allowMaybe : false ,
62- chosenRank : JSON . stringify ( DEFAULT_CHOSEN_RANK ) ,
6373 allowProposals : 'disallow' ,
6474 anonymous : false ,
6575 autoReminder : false ,
76+ chosenRank : JSON . stringify ( DEFAULT_CHOSEN_RANK ) ,
6677 collapseDescription : true ,
6778 expire : 0 ,
6879 forceConfidentialComments : false ,
@@ -299,11 +310,11 @@ export const usePollStore = defineStore('poll', {
299310 }
300311 } ,
301312
302- async add ( payload : { type : PollType ; title : string } ) : Promise < Poll | void > {
313+ async add ( payload : { type : PollType ; title : string ; votingVariant : VotingVariant } ) : Promise < Poll | void > {
303314 const pollsStore = usePollsStore ( )
304315
305316 try {
306- const response = await PollsAPI . addPoll ( payload . type , payload . title )
317+ const response = await PollsAPI . addPoll ( payload . type , payload . title , payload . votingVariant )
307318 return response . data . poll
308319 } catch ( error ) {
309320 if ( ( error as AxiosError ) ?. code === 'ERR_CANCELED' ) {
0 commit comments