@qintx/shein-biz-adapter

0.2.2 • Public • Published

前后端请求接口适配工具

默认提供 Rest/GraphQL/Mock 三种请求方式,支持通过插件进行自定义扩展。

使用方法见测试用例。

自定义插件

插件扩展基于 webpack/Tapable 实现,支持 preRequest/postRequest/init/error 四个扩展点。插件引入示例:

new Adapter(type, {
    ...,
    plugins: [new MyPlugin(options)]
})

自定义插件实现:

class MyPlugin {
    constructor(options) {
        this.options = options
    }

    apply(context) {
        context.plugin('preRequest', (params) => {
            // prepare request params
            // and return extended params
        })
    }
}

export default MyPlugin

Readme

Keywords

none

Package Sidebar

Install

npm i @qintx/shein-biz-adapter

Weekly Downloads

0

Version

0.2.2

License

MIT

Unpacked Size

139 kB

Total Files

22

Last publish

Collaborators

  • qintx