Skip to content

Commit a9678b7

Browse files
committed
fix: add userChoice correctly
1 parent cf34d89 commit a9678b7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hooks/convertPoll.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ export default async (context: HookContext): Promise<HookContext> => {
2222
{ left: { votes: 0 }, right: { votes: 0 } }
2323
));
2424

25-
const userChoice = await VoteModel.findOne({ pollId: poll._id, userId: user?._id });
25+
const userChoice = await VoteModel.findOne(
26+
{ pollId: poll._id, userId: user?._id }
27+
).then(vote => vote?.which);
2628

2729
return _.merge(
2830
_.omit(poll, ['authorId']),

0 commit comments

Comments
 (0)