befly-shared 2.7.0 → 2.8.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/package.json +1 -1
- package/utils/createHttp.js +10 -1
package/package.json
CHANGED
package/utils/createHttp.js
CHANGED
|
@@ -22,7 +22,7 @@ export function createHttp(options) {
|
|
|
22
22
|
const getToken = typeof config.getToken === "function" ? config.getToken : () => "";
|
|
23
23
|
const onReturn = typeof config.onReturn === "function" ? config.onReturn : null;
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
const request = async function (url, data, dropValues, dropKeyValue) {
|
|
26
26
|
try {
|
|
27
27
|
const fullUrl = /^https?:\/\//i.test(url) ? url : `${apiPath}${url}`;
|
|
28
28
|
const isForm = data instanceof FormData;
|
|
@@ -96,4 +96,13 @@ export function createHttp(options) {
|
|
|
96
96
|
return Promise.reject({ msg: "网络连接失败" });
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
get: function (url, data, dropValues, dropKeyValue) {
|
|
102
|
+
return request(url, data, Array.isArray(dropValues) ? [null, undefined, "", ...dropValues] : [null, undefined, ""], dropKeyValue);
|
|
103
|
+
},
|
|
104
|
+
post: function (url, data, dropValues, dropKeyValue) {
|
|
105
|
+
return request(url, data, Array.isArray(dropValues) ? [null, undefined, ...dropValues] : [null, undefined], dropKeyValue);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
99
108
|
}
|