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

// 请求数据
export default {
  namespaced: true,
  state: {
    vipDetails: []
  },
  mutations: {
    setVip (state, data) {
      state.vipDetails = data || []
    }
  },
  actions: {
    getVipDetail (context) {
      console.log(context)
      return new Promise((resolve, reject) => {
        Ajax({
          ...api.user.getVip
        }).then(res => {
          context.commit('setVip', res)
          resolve(res)
        }).catch((err) => {
          reject(err)
        })
      })
    }
  }
}
