Skip to content

Commit 54fad6b

Browse files
authored
chore: support 2 choices for basic voting
1 parent 00888bc commit 54fad6b

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/helpers/utils.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,10 @@ export function hasStrategyOverride(strategies: any[]) {
9292
}
9393

9494
export function validateChoices({ type, choices }): boolean {
95-
if (type && choices.length > 0) {
96-
switch (type) {
97-
case 'basic':
98-
return choices.length === 3;
99-
default:
100-
return true;
101-
}
102-
} else {
103-
return false;
104-
}
95+
if (!type || !choices?.length) return false;
96+
if (type === 'basic') return choices.length === 2 || choices.length === 3;
97+
98+
return true;
10599
}
106100

107101
export function getIp(req) {

0 commit comments

Comments
 (0)