37 lines
648 B
JavaScript
37 lines
648 B
JavaScript
|
|
const state = {
|
||
|
|
courseList: [],
|
||
|
|
currentCourse: null
|
||
|
|
}
|
||
|
|
|
||
|
|
const mutations = {
|
||
|
|
SET_COURSE_LIST(state, list) {
|
||
|
|
state.courseList = list
|
||
|
|
},
|
||
|
|
SET_CURRENT_COURSE(state, course) {
|
||
|
|
state.currentCourse = course
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
const actions = {
|
||
|
|
setCourseList({ commit }, list) {
|
||
|
|
commit('SET_COURSE_LIST', list)
|
||
|
|
},
|
||
|
|
setCurrentCourse({ commit }, course) {
|
||
|
|
commit('SET_CURRENT_COURSE', course)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
const getters = {
|
||
|
|
courseList: state => state.courseList,
|
||
|
|
currentCourse: state => state.currentCourse
|
||
|
|
}
|
||
|
|
|
||
|
|
export default {
|
||
|
|
namespaced: true,
|
||
|
|
state,
|
||
|
|
mutations,
|
||
|
|
actions,
|
||
|
|
getters
|
||
|
|
}
|
||
|
|
|