@whitesev/utils 1.6.0 → 1.7.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.
@@ -1566,11 +1566,13 @@ var Utils = (function () {
1566
1566
  * @private
1567
1567
  */
1568
1568
  beforeRequestCallBack(details) {
1569
- if (!details.allowInterceptConfig) {
1570
- return details;
1571
- }
1572
- if (!details.allowInterceptConfig.beforeRequest) {
1573
- return details;
1569
+ if (details.allowInterceptConfig) {
1570
+ // 首先配置得存在,不然默认允许拦截
1571
+ if (typeof details.allowInterceptConfig.beforeRequest === "boolean" &&
1572
+ !details.allowInterceptConfig.beforeRequest) {
1573
+ // 设置了禁止拦截
1574
+ return details;
1575
+ }
1574
1576
  }
1575
1577
  for (let index = 0; index < this.$config.configList.length; index++) {
1576
1578
  let item = this.$config.configList[index];
@@ -1633,11 +1635,14 @@ var Utils = (function () {
1633
1635
  * @param details 请求的配置
1634
1636
  */
1635
1637
  successResponseCallBack(response, details) {
1636
- if (!details.allowInterceptConfig) {
1637
- return details;
1638
- }
1639
- if (!details.allowInterceptConfig.afterResponseSuccess) {
1640
- return details;
1638
+ if (details.allowInterceptConfig) {
1639
+ // 首先配置得存在,不然默认允许拦截
1640
+ if (typeof details.allowInterceptConfig.afterResponseSuccess ===
1641
+ "boolean" &&
1642
+ !details.allowInterceptConfig.afterResponseSuccess) {
1643
+ // 设置了禁止拦截
1644
+ return details;
1645
+ }
1641
1646
  }
1642
1647
  for (let index = 0; index < this.$config.configList.length; index++) {
1643
1648
  let item = this.$config.configList[index];
@@ -1654,11 +1659,14 @@ var Utils = (function () {
1654
1659
  * @param data 配置
1655
1660
  */
1656
1661
  errorResponseCallBack(data) {
1657
- if (!data.details.allowInterceptConfig) {
1658
- return data;
1659
- }
1660
- if (!data.details.allowInterceptConfig.afterResponseError) {
1661
- return data;
1662
+ if (data.details.allowInterceptConfig) {
1663
+ // 首先配置得存在,不然默认允许拦截
1664
+ if (typeof data.details.allowInterceptConfig.afterResponseError ===
1665
+ "boolean" &&
1666
+ !data.details.allowInterceptConfig.afterResponseError) {
1667
+ // 设置了禁止拦截
1668
+ return data;
1669
+ }
1662
1670
  }
1663
1671
  for (let index = 0; index < this.$config.configList.length; index++) {
1664
1672
  let item = this.$config.configList[index];