Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/745#discussion_r70819553
--- Diff: app/core/ajax.js ---
@@ -0,0 +1,188 @@
+import $ from 'jquery';
+
+export const buildQuery = (query) => (
+ `?${Object.keys(query).reduce((items, item) => (
+ query[item] ? [...items, `${item}=${encodeURIComponent(query[item])}`]
: items
+ ), []).join('&')}`
+);
+
+export const url = (path, query) => (
+ `${path}${!emptyObject(query) ? buildQuery(query) : ''}`
+);
+
+const emptyObject = (object) => (
+ Object.keys(object || {}).length == 0
+);
+
+// ----------------------------------------
+// makes a GET request to the provided path
+// arguments: (options, query)
+// options: {
+// path: '/foo', // the location you want to send the request to
+// }
+// Any optional query paramaters you want to pass
+// query: {}
+// for example
+// query: {
+// page: 1,
+// term: 'foo',
+// }
+// will generate
+// /${path}?page=1&term=foo
+export const request = (options, query) => (
+ $.ajax(Object.assign(
+ emptyObject(options.data)
--- End diff --
can we rename it to something like `isSendingData`?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---