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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "befly-shared",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "gitHead": "70c48ac058875255ac8b54c5f4b5987b997c3bfd",
5
5
  "private": false,
6
6
  "description": "Befly Shared - 通用工具函数库",
@@ -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
- return async function requestPost(url, data, dropValues, dropKeyValue) {
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
  }