fix object error
This commit is contained in:
parent
b2512c0961
commit
96abb6559e
2 changed files with 8 additions and 1 deletions
|
@ -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);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
}
|
||||
else {
|
||||
this.$store.commit("setSurveyCompleted")
|
||||
this.$store.commit("setSkipped", this.$route.params.id)
|
||||
router.push('/results')
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue