import axios from 'axios'
const api = {
  configurationquery: '/api/configuration/query',
  configurationcreate: '/api/configuration/create',
  configurationupdate: '/api/configuration/update'
}

// initial state
const state = () => ({
  configurationdata: {}
})

// actions
const actions = {
  async configurationquery ({ commit }, { filter, paging } = {}) {
    const res = await axios.get(api.configurationquery)
    if (res.data.errcode === 0) commit('configurationquery', res.data)
    return res
  }
}

// mutations
const mutations = {
  configurationquery (state, payload) {
    state.configurationdata = payload.data
  }
}
export default {
  namespaced: true,
  state,
  actions,
  mutations
}
