osm_my_commerce/store/index.ts

38 lines
732 B
TypeScript
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,
hours: [],
tags: [],
},
2020-12-17 12:09:28 +01:00
})
export const mutations = {
increment(state: any) {
state.counter++
},
add(state: any, text: any) {
state.list.push({
text,
done: false,
})
},
remove(state: any, { todo }: any) {
state.list.splice(state.list.indexOf(todo), 1)
},
setFormField(state: any, { field }: any) {
state.formConfig[state.formConfig.indexOf(field)] = field
},
2021-01-21 12:34:21 +01:00
setTag(state: any, { field }: any) {
state.formConfig.tags[state.formConfig.tags.indexOf(field)] = field
},
2020-12-17 12:09:28 +01:00
}