Gcaufy 4f07b2cfa5 feat: added ci release support hace 4 años
..
dist 6d2153bfda build(use-intercept): build dist hace 4 años
test b4db646812 fix(use-intercept): update install code and added test cases hace 4 años
CHANGELOG.md 4f07b2cfa5 feat: added ci release support hace 4 años
README.md 839e63e1f6 docs(use-intercept): update readme doc hace 4 años
index.js b4db646812 fix(use-intercept): update install code and added test cases hace 4 años
install.js b4db646812 fix(use-intercept): update install code and added test cases hace 4 años
package.json 4f07b2cfa5 feat: added ci release support hace 4 años

README.md

@wepy/use-intercept

weapp APIs intercept factory.

Install

npm install @wepy/use-intercept --save

Usage

Basic Usage

import wepy from '@wepy/core';
import useIntercept  from '@wepy/use-intercept';

wepy.use(useIntercept);

const request = wepy.intercept(wepy.wx.request, {
  config(params) {
    console.log(params);
    if (!params.data) {
      params.data = {};
    }
    params.data.t = +new Date();
    return params;
    // return Promise.resolve(params); // support async config interceptor
  },
  success(res) {
    console.log(res);
    return res;
  },
  fail(e) {
    console.log(e);
    return e;
  }
})