38 lines
732 B
TypeScript
38 lines
732 B
TypeScript
/**
|
|
* see VueX docs
|
|
*/
|
|
export const state = () => ({
|
|
counter: 0,
|
|
isFetching: false,
|
|
searchInput: '',
|
|
selectedResult: null,
|
|
list: [],
|
|
formConfig: {
|
|
name: '',
|
|
delivery: false,
|
|
hours: [],
|
|
tags: [],
|
|
},
|
|
})
|
|
|
|
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
|
|
},
|
|
setTag(state: any, { field }: any) {
|
|
state.formConfig.tags[state.formConfig.tags.indexOf(field)] = field
|
|
},
|
|
}
|