mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
save checkboxes state in store
This commit is contained in:
@@ -16,7 +16,8 @@ let getDataPromise = getAccompanyingCourse(id)
|
||||
accompanying_course: accompanying_course,
|
||||
add_persons: {
|
||||
query: "",
|
||||
suggested: []
|
||||
suggested: [],
|
||||
selected: []
|
||||
},
|
||||
errorMsg: []
|
||||
},
|
||||
@@ -24,21 +25,25 @@ let getDataPromise = getAccompanyingCourse(id)
|
||||
},
|
||||
mutations: {
|
||||
removeParticipation(state, item) {
|
||||
console.log('remove item', item.id);
|
||||
//console.log('remove item', item.id);
|
||||
state.accompanying_course.participations = state.accompanying_course.participations.filter(
|
||||
participation => participation !== item
|
||||
);
|
||||
},
|
||||
addParticipation(state, item) {
|
||||
console.log('add new item');
|
||||
//console.log('add new item');
|
||||
state.accompanying_course.participations.push(item);
|
||||
},
|
||||
setQuery(state, query) {
|
||||
console.log('q=', query);
|
||||
//console.log('q=', query);
|
||||
state.add_persons = Object.assign({}, state.add_persons, query);
|
||||
},
|
||||
loadSuggestions(state, suggestions) {
|
||||
state.add_persons.suggested = suggestions;
|
||||
},
|
||||
updateSelected(state, value) {
|
||||
console.log('update value', value);
|
||||
state.add_persons.selected = value;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@@ -49,8 +54,8 @@ let getDataPromise = getAccompanyingCourse(id)
|
||||
commit('addParticipation', payload);
|
||||
postParticipation(id, payload.id).catch((error) => {
|
||||
commit('removeParticipation', payload);
|
||||
state.errorMsg.push(error.message);
|
||||
}) // result action ??
|
||||
state.errorMsg.push(error.message); // result action ??
|
||||
});
|
||||
},
|
||||
setQuery({ commit }, payload) {
|
||||
commit('setQuery', payload);
|
||||
@@ -63,6 +68,9 @@ let getDataPromise = getAccompanyingCourse(id)
|
||||
} else {
|
||||
commit('loadSuggestions', []);
|
||||
}
|
||||
},
|
||||
updateSelected({ commit }, payload) {
|
||||
commit('updateSelected', payload);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user