<NME> rest.js
<BEF> import Axios from "axios";
import config from "../config";

function baseUrl(url) {
  const fullUrl = config.apiUrl + url;
  return fullUrl;
}

export default function(options = {}) {
  let _jwtSelector;

  function ajax(url, method, data, params) {
    console.log(
      `ajax url: ${baseUrl(url)}, method: ${method}, data ${JSON.stringify(data)}, params: ${params}`
    );
    const headers = {
      "Content-Type": "application/json"
    };

    if (_jwtSelector) {
      const jwt = _jwtSelector();
      if (jwt) {
        headers.Authorization = `Bearer ${jwt}`;
      }
    }

    return Axios({
      method,
      url: baseUrl(url),
      params,
      data,
      withCredentials: true,
      headers,
      timeout: 30e3
    })
      .then(res => res.data)
      .catch(error => {
        console.log("ajax error: ", error);
        throw error;
      });
  }

  return {
    setJwtSelector(jwtSelector) {
      _jwtSelector = jwtSelector;
    },
    get(url, opts = {}) {
      return ajax(url, "GET", null, opts);
    },
    post(url, opts = {}) {
      return ajax(url, "POST", opts);
    },
    put(url, opts = {}) {
      return ajax(url, "PUT", opts);
    },
    del(url, opts = {}) {
      return ajax(url, "DELETE", opts);
    },
    patch(url, opts = {}) {
      return ajax(url, "PATCH", opts);
    }
  };
}

<MSG> set latitude and longitude for jobs

<DFF> @@ -1,5 +1,6 @@
 import Axios from "axios";
 import config from "../config";
+import Qs from "qs";
 
 function baseUrl(url) {
   const fullUrl = config.apiUrl + url;
@@ -11,7 +12,9 @@ export default function(options = {}) {
 
   function ajax(url, method, data, params) {
     console.log(
-      `ajax url: ${baseUrl(url)}, method: ${method}, data ${JSON.stringify(data)}, params: ${params}`
+      `ajax url: ${baseUrl(url)}, method: ${method}, data ${JSON.stringify(
+        data
+      )}, params: ${JSON.stringify(params)}`
     );
     const headers = {
       "Content-Type": "application/json"
@@ -29,6 +32,7 @@ export default function(options = {}) {
       url: baseUrl(url),
       params,
       data,
+      paramsSerializer: params => Qs.stringify(params, { arrayFormat: "repeat" }),
       withCredentials: true,
       headers,
       timeout: 30e3

{'addition_count': 5, 'commit_subject': 'set latitude and longitude for jobs', 'deletion_count': 1, 'file_extension': '.js', 'lang': 'js', 'license': 'unlicense', 'repo_name': 'FredericHeem/starhackit'}