covidassist/src/store/index.js

32 lines
579 B
JavaScript
Raw Normal View History

2020-03-21 17:11:07 +01:00
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
currentQuestion: 0,
answers: [],
questions: [{
question: "Test",
answers: ["Answer 1", "Answer 2", "Answer 3"]
}]
},
mutations: {
nextQuestion() {
if(this.state.currentQuestion <=
this.state.questions.length - 1)
this.state.currentQuestion += 1
},
previousQuestion() {
if(this.state.currentQuestion > 0) {
this.state.currentQuestion -= 1
}
}
},
actions: {
},
modules: {
}
})