@base-web-kits/base-tools-web 1.0.2-alpha.2 → 1.0.2-alpha.4
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 +6 -5
- package/dist/base-tools-web.umd.global.js.map +1 -1
- package/dist/config/index.d.ts +20 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/index.cjs +6 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/network/request.d.ts +17 -0
- package/dist/network/request.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/web/config/index.ts +17 -1
- package/src/web/network/request.d.ts +6 -1
- package/src/web/network/request.ts +31 -7
package/dist/index.js
CHANGED
|
@@ -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);
|