import { partnerlList, addPartner, deletePartnerBatch } from '@/api/partner'

const partner = {
  namespaced: true,

  actions: {
    getPartnerList({ commit, state }, data) {
      return new Promise((resolve, reject) => {
        partnerlList(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    createPartner({ commit, state }, data) {
      return new Promise((resolve, reject) => {
        addPartner(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    deletePartner({ commit, state }, data) { // 删除合作伙伴
      return new Promise((resolve, reject) => {
        deletePartnerBatch(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}

export default partner
