@ventlio/tanstack-query 0.2.49 → 0.2.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs
CHANGED
|
@@ -118,14 +118,20 @@ const buildFormData = (body) => {
|
|
|
118
118
|
const bodyKeys = Object.keys(body);
|
|
119
119
|
bodyKeys.forEach((key) => {
|
|
120
120
|
const inputValue = body[key];
|
|
121
|
-
if
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
// if inputValue is array and the first item is array, append everything to the
|
|
122
|
+
if (inputValue instanceof Array && inputValue.length > 0) {
|
|
123
|
+
// append all files
|
|
124
|
+
for (const file of inputValue) {
|
|
125
|
+
formData.append(key, file);
|
|
124
126
|
}
|
|
125
127
|
}
|
|
126
|
-
else
|
|
127
|
-
|
|
128
|
+
// else if inputValue is Object upload it as blob
|
|
129
|
+
else if (inputValue instanceof Object) {
|
|
130
|
+
formData.append(key, new Blob([JSON.stringify(inputValue)], {
|
|
131
|
+
type: 'application/json',
|
|
132
|
+
}));
|
|
128
133
|
}
|
|
134
|
+
formData.append(key, inputValue);
|
|
129
135
|
});
|
|
130
136
|
return formData;
|
|
131
137
|
};
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -5,14 +5,20 @@ const buildFormData = (body) => {
|
|
|
5
5
|
const bodyKeys = Object.keys(body);
|
|
6
6
|
bodyKeys.forEach((key) => {
|
|
7
7
|
const inputValue = body[key];
|
|
8
|
-
if
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
// if inputValue is array and the first item is array, append everything to the
|
|
9
|
+
if (inputValue instanceof Array && inputValue.length > 0) {
|
|
10
|
+
// append all files
|
|
11
|
+
for (const file of inputValue) {
|
|
12
|
+
formData.append(key, file);
|
|
11
13
|
}
|
|
12
14
|
}
|
|
13
|
-
else
|
|
14
|
-
|
|
15
|
+
// else if inputValue is Object upload it as blob
|
|
16
|
+
else if (inputValue instanceof Object) {
|
|
17
|
+
formData.append(key, new Blob([JSON.stringify(inputValue)], {
|
|
18
|
+
type: 'application/json',
|
|
19
|
+
}));
|
|
15
20
|
}
|
|
21
|
+
formData.append(key, inputValue);
|
|
16
22
|
});
|
|
17
23
|
return formData;
|
|
18
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildFormData.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildFormData.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -5,13 +5,25 @@ export const buildFormData = (body: Record<string, any>) => {
|
|
|
5
5
|
|
|
6
6
|
bodyKeys.forEach((key) => {
|
|
7
7
|
const inputValue = body[key];
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
|
|
9
|
+
// if inputValue is array and the first item is array, append everything to the
|
|
10
|
+
if (inputValue instanceof Array && inputValue.length > 0) {
|
|
11
|
+
// append all files
|
|
12
|
+
for (const file of inputValue) {
|
|
13
|
+
formData.append(key, file);
|
|
11
14
|
}
|
|
12
|
-
} else {
|
|
13
|
-
formData.append(key, inputValue);
|
|
14
15
|
}
|
|
16
|
+
// else if inputValue is Object upload it as blob
|
|
17
|
+
else if (inputValue instanceof Object) {
|
|
18
|
+
formData.append(
|
|
19
|
+
key,
|
|
20
|
+
new Blob([JSON.stringify(inputValue)], {
|
|
21
|
+
type: 'application/json',
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
formData.append(key, inputValue);
|
|
15
27
|
});
|
|
16
28
|
|
|
17
29
|
return formData;
|