@@ -64,6 +64,12 @@ class WdRequest {
}
},
fail: (error) => {
+ if (this.config?.interceptor?.responseErrorFn) {
+ error = this.config.interceptor.responseErrorFn(error)
+ }
+ if (config?.interceptor?.responseErrorFn) {
+ error = config?.interceptor?.responseErrorFn(error)
reject(error)
})
@@ -1,6 +1,7 @@
interface IInterceptor {
requestSuccessFn?: (config: WdUploadFileOptions | WdRequestOptions) => any
responseSuccessFn?: (config: any) => any
+ responseErrorFn?: (config: any) => any
// 构造函数的配置