import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) export default new Vuex.Store({ state: { counter: 0, isFetching: false, searchInput: '', selectedResult: null, list: [], formConfig: { name: '', delivery: false, hours: [], tags: [], }, }, 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 }, }, actions: {}, modules: {}, })