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