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') } },