osm_my_commerce/store/index.js

38 lines
695 B
JavaScript
Raw Normal View History

2021-01-21 12:34:21 +01:00
/**
* see VueX docs
*/
2020-12-17 12:09:28 +01:00
export const state = () => ({
counter: 0,
2021-01-21 12:34:21 +01:00
isFetching: false,
searchInput: '',
selectedResult: null,
2020-12-17 12:09:28 +01:00
list: [],
2021-01-21 12:34:21 +01:00
formConfig: {
name: '',
delivery: false,
2021-01-28 13:12:24 +01:00
hours: ['a', 'b'],
2021-01-21 12:34:21 +01:00
tags: [],
},
2020-12-17 12:09:28 +01:00
})
export const mutations = {
2021-01-28 13:12:24 +01:00
increment(state) {
2020-12-17 12:09:28 +01:00
state.counter++
},
2021-01-28 13:12:24 +01:00
add(state, text) {
2020-12-17 12:09:28 +01:00
state.list.push({
text,
done: false,
})
},
2021-01-28 13:12:24 +01:00
remove(state, { todo }) {
2020-12-17 12:09:28 +01:00
state.list.splice(state.list.indexOf(todo), 1)
},
2021-01-28 13:12:24 +01:00
setFormField(state, { field }) {
2020-12-17 12:09:28 +01:00
state.formConfig[state.formConfig.indexOf(field)] = field
},
2021-01-28 13:12:24 +01:00
setTag(state, { field }) {
2021-01-21 12:34:21 +01:00
state.formConfig.tags[state.formConfig.tags.indexOf(field)] = field
},
2020-12-17 12:09:28 +01:00
}