httpRequestHandler.js 425 B

12345678910111213141516
  1. import axios from 'axios';
  2. export function request (method, uri, data, headers = null, params = null) {
  3. let query = {
  4. method,
  5. url: uri
  6. };
  7. if (headers !== null)
  8. query.headers = headers;
  9. if (params !== null)
  10. query.params = params;
  11. if (method === 'post' || method === 'put' || method === 'delete' || method === 'patch')
  12. query.data = data;
  13. return axios(query);
  14. }