import { request } from '../utils/request';

const CITY_SERVICE = '/Cityinterface/rest/services';
// export const CITY_SERVICE = '/Publish/GateWay/CityServer';
const PUBLISH_SERVICE = '/PandaOMS/OMS';
// export const PUBLISH_SERVICE = '/Publish/GateWay/OMS';
const get = async (url, params, options = {}) =>
  request({
    url,
    method: 'get',
    params,
    ...options,
  });

const post = async (url, params, options = {}) =>
  request({
    url,
    params,
    method: 'post',
    ...options,
  });

const postForm = async (url, params = {}, options = {}) => {
  const formData = new FormData();
  Object.keys(params).forEach(k => formData.append(k.trim(), params[k]));
  return post(url, formData, options);
};

export { get, post, postForm, CITY_SERVICE, PUBLISH_SERVICE };
