import axios from 'axios';
import signature from './signature';

const HttpUtils = {};

HttpUtils.post = (url, params) => {
  let pa = Object.assign({}, params);

  let headers = signature.getRequestHeader();
  let data = signature.cover(pa, headers, headers['X-Client-Time']);

  return axios({
    method: 'post',
    url: url,
    headers: headers,
    data: data
  }).then((res) => {
    return Promise.resolve(res.data);
  });
};

export default HttpUtils;
