import Ajax from '../../util/ajax'
import api from '../../util/api'

// 请求数据
export default {
  namespaced: true,
  state: {
    customerList: []
  },
  mutations: {
    setCustomerList (state, data) { // 设置页面信息
      state.customerList = data
    }
  },
  actions: {
    getCustomerList (context) { // 获取课程详情信息
      return new Promise((resolve) => {
        Ajax(api.card.myCustomer.url, {
          method: api.card.myCustomer.method
        }).then(res => {
          context.commit('setCustomerList', res)
          resolve(res)
        }).catch((err) => {
          reject(err)
        })
      })
    }
  }
}