const state = {
  goodsId: null,
  goodsName: null
}

const mutations = {
  SET_GOODS_ID: (state, goodsId) => {
    state.goodsId = goodsId
  },
  SET_GOODS_NAME: (state, goodsName) => {
    state.goodsName = goodsName
  }
}

const actions = {
  // goods name
  setGoodsInfo({ commit }, goods) {
    const { goodsId, goodsName } = goods
    return new Promise((resolve, reject) => {
      commit('SET_GOODS_ID', goodsId)
      commit('SET_GOODS_NAME', goodsName)
    })
  }
}

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