import axios from 'axios' export default { namespaced: true, state: { users: [], dialog: { show: false, type: null, info: {} } }, mutations: { setUsers (state, users) { state.users = users }, setDialog (state, { show, type, info }) { if (info !== undefined) state.dialog.info = info if (type !== undefined) state.dialog.type = type if (show !== undefined) state.dialog.show = show } }, actions: { loadData (context) { axios.get('/api/users').then(response => { context.commit('setUsers', response.data) }) } } }