import Vue from 'vue'
import Vuex from 'vuex'
// import axios from 'axios'
import Crud from '../crud'
const model = (payload) => ({
  id: payload.id,
  contact: payload.contact,
  address: payload.address,
  state: payload.state,
  phone: payload.phone,
  email: payload.email
})
var crud = new Crud('Customers', model)

Vue.use(Vuex)

const state = {
  ...crud.state,
  customers: []
}

const mutations = {
  ...crud.mutations
}

const actions = {
  ...crud.actions
}

const getters = {
  ...crud.getters,
  customers: state => state.customers
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
