Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2021-01-12 14:00:15 +0300
committerdartcafe <github@dartcafe.de>2021-01-12 14:00:31 +0300
commit732f0c6b418cf4f373145cbfc5219f37a56a021c (patch)
tree1b551955783104f1d01db72fc6e002c673329216 /src/js/store
parentac743ac95c3f0b3e7938f0fb09bb18a7f39a6ec4 (diff)
fix reactivity problem with vote answer
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'src/js/store')
-rw-r--r--src/js/store/modules/subModules/votes.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/js/store/modules/subModules/votes.js b/src/js/store/modules/subModules/votes.js
index 426adbf1..0445a00d 100644
--- a/src/js/store/modules/subModules/votes.js
+++ b/src/js/store/modules/subModules/votes.js
@@ -100,10 +100,19 @@ const getters = {
},
getVote: (state) => (payload) => {
- return state.list.find(vote => {
+ const found = state.list.find(vote => {
return (vote.userId === payload.userId
&& vote.voteOptionText === payload.option.pollOptionText)
})
+ if (found === undefined) {
+ return {
+ voteAnswer: '',
+ voteOptionText: payload.option.pollOptionText,
+ userId: payload.userId,
+ }
+ } else {
+ return found
+ }
},
}
@@ -141,7 +150,7 @@ const actions = {
setTo: payload.setTo,
})
.then((response) => {
- context.commit('setItem', { option: payload.option, pollId: context.rootState.route.params.id, vote: response.data.vote })
+ context.commit('setItem', { option: payload.option, pollId: context.rootState.poll.id, vote: response.data.vote })
return response.data
})
.catch((error) => {