Gcaufy 4f07b2cfa5 feat: added ci release support | hace 4 años | |
---|---|---|
.. | ||
dist | hace 4 años | |
test | hace 4 años | |
CHANGELOG.md | hace 4 años | |
README.md | hace 4 años | |
index.js | hace 4 años | |
install.js | hace 4 años | |
package.json | hace 4 años |
weapp APIs intercept factory.
npm install @wepy/use-intercept --save
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;
}
})