@jswork/weapp-loading-interceptor
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

weapp-loading-interceptor

Loading interceptor for weapp.

version license size download

installation

npm install @jswork/weapp-loading-interceptor

usage

import createInterceptors from '@jswork/weapp-loading-interceptor';

const weappLoadingIntercepotrs = createInterceptors({
  onShow: (opts) => {
    wx.showLoading({ title: '加载中', mask: true });
  },
  onHide: (opts) => {
    wx.hideLoading();
  },
});

const opts = {
  adapter: 'UniappRequest',
  slim: true,
  interceptors: [...interceptorRequest, ...interceptorResponse, ...weappLoadingIntercepotrs],
  transformResponse(inResponse) {
    return inResponse.data;
  },
};

nx.$api = httpSchema(schema, opts);

license

Code released under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i @jswork/weapp-loading-interceptor

Homepage

js.work

Weekly Downloads

0

Version

1.0.7

License

MIT

Unpacked Size

8.6 kB

Total Files

6

Last publish

Collaborators

  • afeiship
  • yujiao.luo