export default function mapActions (service) {
  const { vuexOptions } = service
  const idField = vuexOptions.module.idField || vuexOptions.global.idField
  const methods = ['find', 'get', 'create', 'update', 'patch', 'remove']
  const availableActions = {
    find ({ commit, dispatch }, params) {
      commit('setPending')
      return service.find(params)
        .then(response => {
          commit('unsetPending')
          let data = response.data || response
          data.map(item => dispatch('addOrUpdate', item))
          return response
        })
    },

    get ({ commit, dispatch }, params) {
      let id
      if (typeof params === 'string' || typeof params === 'number') {
        id = params[idField]
        delete params[idField]
      } else {
        id = params
        params = undefined
      }
      commit('setPending')
      return service.get(id, params)
        .then(item => {
          commit('unsetPending')
          dispatch('addOrUpdate', item)
          commit('setCurrent', item)
          return item
        })
    },

    create ({ commit, dispatch }, data) {
      commit('setPending')
      return service.create(data)
        .then(item => {
          commit('unsetPending')
          dispatch('addOrUpdate', item)
          commit('setCurrent', item)
          return item
        })
    },

    update ({ commit, dispatch }, id, data) {
      commit('setPending')
      commit('unsetPending')
      console.log(id)
      console.log(data)
    },

    patch ({ commit, dispatch }) {
      commit('setPending')
      commit('unsetPending')
    },
    remove ({ commit, dispatch }) {
      commit('setPending')
      commit('unsetPending')
    },

    addOrUpdate ({ state, commit }, item) {
      let id = item[idField]
      if (id === undefined) {
        throw new Error('No id found for item. Did you set the idField?', item)
      }
      let existing = state.keyedById[id]
      existing ? commit('updateItem', item) : commit('addItem', item)
    }
  }

  const actions = {}
  methods.map(method => {
    if (typeof service[method] === 'function') {
      actions[method] = availableActions[method]
    }
  })
  return actions
}

@@ -153,81 +153,8 @@
 eld%0A
-  const methods = %5B'find', 'get', 'create', 'update', 'patch', 'remove'%5D%0A
   co
@@ -1957,15 +1957,37 @@
 %7D%0A  
-methods
+Object.keys(availableActions)
 .map

Remove unneeded methods array