Skip to content
This repository has been archived by the owner on May 20, 2021. It is now read-only.

Update QueryApiUtils.js #230

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/main/resources/assets/javascripts/utils/QueryApiUtils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import _ from 'lodash';
// Lodash functions
import map from 'lodash/map';
import join from 'lodash/join';
import objectKeys from 'lodash/keys';

import checkResults from './checkResults';
import xhr from './xhr';

Expand All @@ -8,12 +12,8 @@ let QueryApiUtils = {
},

createQuery(data) {
let formData = Object.keys(data).reduce((encoded, key) => {
const encKey = encodeURIComponent(key);
const encData = encodeURIComponent(data[key]);
return `${encoded}&${encKey}=${encData}`
}, '');

let formData = join(map(objectKeys(data), key => `${encodeURIComponent(key)}=${encodeURIComponent(data[key])}`), "&");

return xhr('/api/query/saved', {
method: 'post',
headers: {
Expand Down