import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/communitys',
    method: 'get',
    params: query
  })
}

export function createCommunity(data) {
  return request({
    url: '/community/add',
    method: 'post',
    data
  })
}

export function updateCommunity(data) {
  return request({
    url: '/community/update',
    method: 'post',
    data
  })
}

export function fetchProvinceList() {
  return request({
    url: '/common/province',
    method: 'get'
  })
}

export function fetchCityList(query) {
  return request({
    url: '/common/city',
    method: 'get',
    params: { provinceId: query }
  })
}

export function fetchDistrictList(query) {
  return request({
    url: '/common/district',
    method: 'get',
    params: { cityId: query }
  })
}
