import Vue from 'vue'
import Vuex from 'vuex'
// import axios from 'axios' // remove comment if yu needed
import Crud from '../crud'
const model = (payload) => ({
  id: payload.id,
  name: payload.name,
  email: payload.email,
  password: payload.password,
  role: payload.role
})
var crud = new Crud('Users', model)

Vue.use(Vuex)

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

const mutations = {
  ...crud.mutations
}

const actions = {
  ...crud.actions
}

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

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