@alicloud/console-fetcher-interceptor-res-risk
TypeScript icon, indicating that this package has built-in type declarations

1.7.0 • Public • Published

@alicloud/console-fetcher-interceptor-res-risk

@alicloud/console-fetcher 的响应拦截器 - 风控

包含旧版的主账号风控、新版的主账号风控、新版的子账号风控三部分逻辑。

INSTALL

tnpm i @alicloud/console-fetcher-interceptor-res-biz @alicloud/console-fetcher-interceptor-res-risk -S

注意,风控拦截器依赖 @alicloud/console-fetcher-interceptor-res-biz 对响应进行拦截并抛出业务级别的 Error。

API

import createFetcher, {
  Fetcher
} from '@alicloud/fetcher';
// import interceptors 1
import interceptBiz from '@alicloud/console-fetcher-interceptor-res-biz'; // 必需在风控拦截之前
// import interceptors 2
import interceptRisk from '@alicloud/console-fetcher-interceptor-res-risk';
// import interceptors 3

const fetcher: Fetcher = createFetcher();

// ... add interceptors 1
interceptBiz(fetcher);
// ... add interceptors 2
interceptRisk(fetcher, { // 自定义属性,均可选
  // 从错误 data 中获取对应的信息
  // dataPathVerifyUrl?: string;
  // dataPathValidators?: string;
  // dataPathUserId?: string;
  // dataPathExtend?: string;
  // dataPathCodeType?: string;
  // dataPathVerifyType?: string;
  // dataPathVerifyDetail?: string;
  // dataPathOldCodeType?: string;
  // dataPathOldVerifyType?: string;
  // dataPathOldVerifyDetail?: string;
  // codeNeedVerify?: string; // 风控 - 需要用验证码进行二次验证
  // codeForbidden?: string; // 风控 - 中断业务流程
  // codeInvalidInput?: string; // // 验证码错误
});
// ... add interceptors 3

export default fetcher

Dependents (2)

Package Sidebar

Install

npm i @alicloud/console-fetcher-interceptor-res-risk

Weekly Downloads

1

Version

1.7.0

License

MIT

Unpacked Size

36.5 kB

Total Files

42

Last publish

Collaborators

  • jacksontian
  • fengmk2
  • pagecao
  • aliyunsdkteam
  • console-fe