@base-web-kits/base-tools-web 1.0.2-alpha.1 → 1.0.2-alpha.3
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 +8 -7
- package/dist/base-tools-web.umd.global.js.map +1 -1
- package/dist/config/index.d.ts +5 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/index.cjs +9 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/network/request.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/web/config/index.ts +2 -2
- package/src/web/network/request.ts +6 -5
package/dist/index.js
CHANGED
|
@@ -220,7 +220,7 @@ var appConfig = {};
|
|
|
220
220
|
function getAppConfig() {
|
|
221
221
|
return appConfig;
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function setBaseToolsConfig(newConfig) {
|
|
224
224
|
Object.assign(appConfig, newConfig);
|
|
225
225
|
}
|
|
226
226
|
|
|
@@ -1591,20 +1591,21 @@ function request(config) {
|
|
|
1591
1591
|
reject(res);
|
|
1592
1592
|
appConfig2.toLogin?.();
|
|
1593
1593
|
} else {
|
|
1594
|
-
if (toastError && msg) appConfig2.toast?.(msg);
|
|
1594
|
+
if (toastError && msg) appConfig2.toast?.({ status: "fail", msg });
|
|
1595
1595
|
reject(res);
|
|
1596
1596
|
}
|
|
1597
1597
|
} catch (e) {
|
|
1598
|
+
const status = "fail";
|
|
1598
1599
|
const isAbortError = e instanceof DOMException && e.name === "AbortError";
|
|
1599
1600
|
if (isAbortError && isTimeout) {
|
|
1600
|
-
if (toastError) appConfig2.toast?.("\u8BF7\u6C42\u8D85\u65F6");
|
|
1601
|
+
if (toastError) appConfig2.toast?.({ status, msg: "\u8BF7\u6C42\u8D85\u65F6" });
|
|
1601
1602
|
const timeoutError = new Error("Request Timeout");
|
|
1602
|
-
logRequestInfo({ status
|
|
1603
|
+
logRequestInfo({ status, config: logConfig, startTime, e: timeoutError });
|
|
1603
1604
|
reject(timeoutError);
|
|
1604
1605
|
return;
|
|
1605
1606
|
}
|
|
1606
|
-
if (!isAbortError && toastError) appConfig2.toast?.("\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25");
|
|
1607
|
-
logRequestInfo({ status
|
|
1607
|
+
if (!isAbortError && toastError) appConfig2.toast?.({ status, msg: "\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25" });
|
|
1608
|
+
logRequestInfo({ status, config: logConfig, startTime, e });
|
|
1608
1609
|
reject(e);
|
|
1609
1610
|
} finally {
|
|
1610
1611
|
if (timeoutId) clearTimeout(timeoutId);
|
|
@@ -1796,7 +1797,7 @@ export {
|
|
|
1796
1797
|
removeCookie,
|
|
1797
1798
|
removeLocalStorage,
|
|
1798
1799
|
request,
|
|
1799
|
-
|
|
1800
|
+
setBaseToolsConfig,
|
|
1800
1801
|
setCookie,
|
|
1801
1802
|
setLocalStorage,
|
|
1802
1803
|
unlockBodyScroll,
|