@base-web-kits/base-tools-web 1.2.10 → 1.3.0
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/base-tools-web.umd.global.js +7 -7
- package/dist/base-tools-web.umd.global.js.map +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/network/uploadFile.d.ts +2 -2
- package/dist/network/uploadFile.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/web/network/uploadFile.ts +9 -9
package/dist/index.cjs
CHANGED
|
@@ -1426,7 +1426,7 @@ function upload(option, config) {
|
|
|
1426
1426
|
return new Promise((resolve, reject) => {
|
|
1427
1427
|
var _a;
|
|
1428
1428
|
const xhr = new XMLHttpRequest();
|
|
1429
|
-
const { url, file, name = "file", header,
|
|
1429
|
+
const { url, file, name = "file", header, data, timeout = 0 } = option;
|
|
1430
1430
|
const fail = (error) => reject(error);
|
|
1431
1431
|
const success = (responseText) => {
|
|
1432
1432
|
resolve(responseText);
|
|
@@ -1465,14 +1465,14 @@ function upload(option, config) {
|
|
|
1465
1465
|
});
|
|
1466
1466
|
}
|
|
1467
1467
|
xhr.timeout = timeout;
|
|
1468
|
-
const
|
|
1469
|
-
if (
|
|
1470
|
-
Object.entries(
|
|
1471
|
-
if (v !== void 0 && v !== null)
|
|
1468
|
+
const formData = new FormData();
|
|
1469
|
+
if (data) {
|
|
1470
|
+
Object.entries(data).forEach(([k, v]) => {
|
|
1471
|
+
if (v !== void 0 && v !== null) formData.append(k, String(v));
|
|
1472
1472
|
});
|
|
1473
1473
|
}
|
|
1474
|
-
|
|
1475
|
-
xhr.send(
|
|
1474
|
+
formData.append(name, file);
|
|
1475
|
+
xhr.send(formData);
|
|
1476
1476
|
});
|
|
1477
1477
|
}
|
|
1478
1478
|
function uploadFile(option, config) {
|