We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 385b38f commit 12a3178Copy full SHA for 12a3178
src/utils/fetch.js
@@ -31,10 +31,16 @@
31
/*
32
* Creates URL request path
33
*/
34
-const encodeQueryData = data => Object.keys(data)
35
- .filter(k => typeof data[k] !== 'object')
36
- .map(k => encodeURIComponent(k) + '=' + encodeURIComponent(data[k]))
37
- .join('&');
+const encodeQueryData = (data, nesting = '') => {
+ const pairs = Object.entries(data).map(([key, val]) => {
+ if (typeof val === 'object') {
+ return encodeQueryData(val, nesting + `${key}.`);
38
+ } else {
39
+ return encodeURIComponent(nesting + key) + '=' + encodeURIComponent(val);
40
+ }
41
+ });
42
+ return pairs.join('&');
43
+};
44
45
const bodyTypes = [
46
window.ArrayBuffer,
0 commit comments