@xtdev/bff-request-miniprogram
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -72,9 +72,8 @@ class BFFRequest { | ||
url = this.baseURL + url; | ||
const opt = Object.assign(Object.assign({ url, data: params, method, dataType: 'json', responseType: 'text' }, arg), { success: (res) => { | ||
this.responseInterceptor && this.responseInterceptor(res); | ||
resolve(res); | ||
let opt = Object.assign(Object.assign({ url, data: params, method, dataType: 'json', responseType: 'text' }, arg), { success: (res) => { | ||
this.responseInterceptor ? resolve(this.responseInterceptor(res)) : resolve(res); | ||
}, fail: (err) => { | ||
reject(err); | ||
} }); | ||
this.requestInterceptor && this.requestInterceptor(opt); | ||
opt = this.requestInterceptor ? this.requestInterceptor(opt) : opt; | ||
wx.request(opt); | ||
@@ -81,0 +80,0 @@ }); |
{ | ||
"name": "@xtdev/bff-request-miniprogram", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "a http request for xiantan BFF", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -35,3 +35,3 @@ /// <reference path="node_modules/wechat-miniprogram/index.d.ts" | ||
*/ | ||
requestInterceptor: null | ((res: WechatMiniprogram.RequestOption) => void) = null | ||
requestInterceptor: null | ((res: WechatMiniprogram.RequestOption) => WechatMiniprogram.RequestOption) = null | ||
/** | ||
@@ -41,3 +41,3 @@ * 返回拦截器 | ||
*/ | ||
responseInterceptor: null | ((res: WechatMiniprogram.RequestSuccessCallbackResult) => void) = null | ||
responseInterceptor: null | ((res: WechatMiniprogram.RequestSuccessCallbackResult) => any) = null | ||
/** | ||
@@ -84,3 +84,3 @@ * 网络请求Post | ||
if(this.baseURL && !url.startsWith('http')) url = this.baseURL + url | ||
const opt = { | ||
let opt = { | ||
url, | ||
@@ -93,4 +93,3 @@ data: params, | ||
success: (res: WechatMiniprogram.RequestSuccessCallbackResult): void => { | ||
this.responseInterceptor && this.responseInterceptor(res); | ||
resolve(res); | ||
this.responseInterceptor ? resolve(this.responseInterceptor(res)) : resolve(res); | ||
}, | ||
@@ -101,3 +100,3 @@ fail: (err: WechatMiniprogram.GeneralCallbackResult): void => { | ||
}; | ||
this.requestInterceptor && this.requestInterceptor(opt); | ||
opt = this.requestInterceptor ? this.requestInterceptor(opt) : opt; | ||
wx.request(opt); | ||
@@ -104,0 +103,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6612
184