| 1234567891011121314151617181920212223242526 |
- import * as ACTIONS from "@/store/type/actions.type";
- import * as MUTATIONS from "@/store/type/mutations.type.js";
- import { getCourseDetail } from "@/api/course";
- const courseState = {
- currentCourse: {}
- };
- const actions = {
- async [ACTIONS.FETCH_CURRENT_COURSE](context, courseId) {
- const { data } = await getCourseDetail(courseId);
- context.commit(MUTATIONS.SET_CURRENT_COURSE, data);
- }
- };
- const mutations = {
- [MUTATIONS.SET_CURRENT_COURSE](state, courseSerializer = {}) {
- state.currentCourse = courseSerializer;
- }
- };
- export default {
- state: courseState,
- actions,
- mutations
- };
|