|
@@ -1,7 +1,8 @@
|
|
|
|
|
|
export const state = () => ({
|
|
|
items : [],
|
|
|
- item : []
|
|
|
+ item : [],
|
|
|
+ canUpdateCourse: false
|
|
|
})
|
|
|
|
|
|
export const actions = {
|
|
@@ -43,9 +44,13 @@ export const actions = {
|
|
|
updateLine({commit}, {index, value, field}) {
|
|
|
commit('setLineValue', {index, value, field})
|
|
|
// Surprise commit for next lectures (:
|
|
|
+ commit('setCanUpdateCourse', true)
|
|
|
+
|
|
|
},
|
|
|
updateCourseValue({commit}, {value, field}) {
|
|
|
commit('setCourseValue', {value, field})
|
|
|
+ commit('setCanUpdateCourse', true)
|
|
|
+
|
|
|
},
|
|
|
async updateCourse({state, commit}) {
|
|
|
try {
|
|
@@ -55,6 +60,7 @@ export const actions = {
|
|
|
console.log('courses.js mutations call setCourse')
|
|
|
commit('setCourse', course)
|
|
|
console.log('courses.js mutations done setCourse')
|
|
|
+ commit('setCanUpdateCourse', false)
|
|
|
return state.item
|
|
|
} catch (error) {
|
|
|
return error
|
|
@@ -86,5 +92,8 @@ export const mutations = {
|
|
|
},
|
|
|
setCourseValue(state, {value, field}){
|
|
|
state.item[field] = value
|
|
|
- }
|
|
|
+ },
|
|
|
+ setCanUpdateCourse(state, canUpdate) {
|
|
|
+ state.canUpdateCourse = canUpdate
|
|
|
+ },
|
|
|
}
|