Skip to content

Commit

Permalink
Merge pull request #2776 from openmsupply/#2713-add-dispensary-lookup…
Browse files Browse the repository at this point in the history
…-wildcards

#2713 add wildcard to lookup query parameters
  • Loading branch information
wlthomson authored Apr 27, 2020
2 parents 299289a + e2c2f87 commit fdeeb8b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sync/lookupApiUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const RESOURCES = {
const SEPARATORS = {
QUERY_STRING: '?',
QUERY_PARAMETERS: '&',
QUERY_WILDCARD: '@',
POLICY_NUMBER: '-',
};

export const createPatientRecord = patient => {
Expand All @@ -39,7 +41,7 @@ const getQueryString = params =>
params.reduce((queryString, param) => {
const [[key, value]] = Object.entries(param);
if (!value) return queryString;
const paramString = `${key}=${value}`;
const paramString = `${key}=${SEPARATORS.QUERY_WILDCARD}${value}${SEPARATORS.QUERY_WILDCARD}`;
const paramSeparator = queryString.length > 0 ? SEPARATORS.PARAMETERS : SEPARATORS.QUERY_STRING;
return queryString + paramSeparator + paramString;
}, '');
Expand Down

0 comments on commit fdeeb8b

Please sign in to comment.