aboutsummaryrefslogtreecommitdiff
path: root/resources/js/store.js
diff options
context:
space:
mode:
Diffstat (limited to 'resources/js/store.js')
-rw-r--r--resources/js/store.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/resources/js/store.js b/resources/js/store.js
index 345b866..e0c4383 100644
--- a/resources/js/store.js
+++ b/resources/js/store.js
@@ -17,6 +17,9 @@ export default new Vuex.Store({
},
getData(state) {
return state.data;
+ },
+ getDataRow(state) {
+ return (index) => _.cloneDeep(state.data[index]);
}
},
mutations: {
@@ -28,6 +31,12 @@ export default new Vuex.Store({
},
setData(state, data) {
state.data = data;
+ },
+ setDataRow(state, row) {
+ state.data[row.index] = _.cloneDeep(row.data);
+ },
+ removeDataRow(state, index) {
+ state.data.splice(index, 1);
}
},
actions: {
@@ -54,6 +63,15 @@ export default new Vuex.Store({
}).catch(error => {
console.log(error);
});
+ },
+ async pushReservation(context, data) {
+ context.commit('setDataRow', {
+ index: data.index,
+ data: data.reservation
+ });
+ },
+ async removeReservation(context, index) {
+ context.commit('removeDataRow', index);
}
}
});