/* eslint-disable no-confusing-arrow */

import { get, post } from '@/api/request'
import CONFIG from '@/config'

const { privateDomain } = CONFIG
const flag = process.env.X_CA_STAGE

// 获取地址列表
export const getAddressList = data =>
  flag
    ? get('/mtsw/address/getAddressList', { data })
    : get('/mtsw/MtswAddress/getAddressList', { data, baseURL: privateDomain })

// 删除地址
export const removeAddress = data =>
  flag ? post('/mtsw/address/delAddress', data) : post('/mtsw/MtswAddress/delAddress', data, { baseURL: privateDomain })

// 编辑地址
export const setAddress = data =>
  flag
    ? post('/mtsw/address/editAddress', data)
    : post('/mtsw/MtswAddress/editAddress', data, { baseURL: privateDomain })
// 新增地址
export const addAddress = data =>
  flag
    ? post('/mtsw/address/addAddress', data, { method: 'post' })
    : post('/mtsw/MtswAddress/addAddress', data, { method: 'post', baseURL: privateDomain })
