From 96abb6559efbdef9af9b7b6ba809c1d2c437902b Mon Sep 17 00:00:00 2001 From: thilo Date: Sun, 22 Mar 2020 21:07:21 +0100 Subject: [PATCH] fix object error --- src/store/index.js | 8 +++++++- src/views/HelpPage.vue | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index 8dd1086..c38de7f 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -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); }) } }, diff --git a/src/views/HelpPage.vue b/src/views/HelpPage.vue index 0366985..254e796 100644 --- a/src/views/HelpPage.vue +++ b/src/views/HelpPage.vue @@ -44,6 +44,7 @@ } else { this.$store.commit("setSurveyCompleted") + this.$store.commit("setSkipped", this.$route.params.id) router.push('/results') } },