aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/utils.js')
-rw-r--r--frontend/src/utils.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/frontend/src/utils.js b/frontend/src/utils.js
index b72ada7..db9405c 100644
--- a/frontend/src/utils.js
+++ b/frontend/src/utils.js
@@ -3,3 +3,12 @@ export function createCurlCommand(subCommand, data) {
return `curl --request PUT \\\n --url ${full}/api${subCommand} \\\n ` +
`--header 'content-type: application/json' \\\n --data '${JSON.stringify(data)}'`;
}
+
+export function objectToQueryString(obj) {
+ let str = [];
+ for (let p in obj)
+ if (obj.hasOwnProperty(p)) {
+ str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
+ }
+ return str.join("&");
+}