fix object error

This commit is contained in:
thilo 2020-03-22 21:07:21 +01:00
parent b2512c0961
commit 96abb6559e
2 changed files with 8 additions and 1 deletions

View file

@ -8,6 +8,7 @@ export default new Vuex.Store({
state: {
surveyCompletedOnce: false,
answers: [],
skipped: [],
questions: []
},
mutations: {
@ -17,6 +18,9 @@ export default new Vuex.Store({
answerQuestion(state, pl) {
this.state.answers[pl.id] = pl.answer
},
setSkipped(state, n) {
this.state.skipped[n] = true
},
setSurveyCompleted() {
this.state.surveyCompletedOnce = true
},
@ -25,7 +29,9 @@ export default new Vuex.Store({
.then(res => {
console.log(res)
this.state.questions = res.data
this.state.answers = Array.apply(0, Array(res.data.length)).map(function () {})
this.state.answers = Array(res.data.length).fill(0);
this.state.skipped = Array(res.data.length).fill(false);
})
}
},

View file

@ -44,6 +44,7 @@
}
else {
this.$store.commit("setSurveyCompleted")
this.$store.commit("setSkipped", this.$route.params.id)
router.push('/results')
}
},