@@ -14,7 +14,7 @@ class Request {
14
14
// 检查请求拦截
15
15
if ( this . interceptor . request && typeof this . interceptor . request === 'function' ) {
16
16
let tmpConfig = { } ;
17
- let interceptorReuest = this . interceptor . request ( options ) ;
17
+ let interceptorReuest = await this . interceptor . request ( options ) ;
18
18
if ( interceptorReuest === false ) {
19
19
return false ;
20
20
}
@@ -29,7 +29,7 @@ class Request {
29
29
options . method = options . method || this . config . method ;
30
30
31
31
return new Promise ( ( resolve , reject ) => {
32
- options . complete = ( response ) => {
32
+ options . complete = async ( response ) => {
33
33
// 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
34
34
uni . hideLoading ( ) ;
35
35
// 清除定时器,如果请求回来了,就无需loading
@@ -38,7 +38,7 @@ class Request {
38
38
if ( this . config . originalData ) {
39
39
// 判断是否存在拦截器
40
40
if ( this . interceptor . response && typeof this . interceptor . response === 'function' ) {
41
- let resInterceptors = this . interceptor . response ( response ) ;
41
+ let resInterceptors = await this . interceptor . response ( response ) ;
42
42
// 如果拦截器不返回false,就将拦截器返回的内容给this.$u.post的then回调
43
43
if ( resInterceptors !== false ) {
44
44
resolve ( resInterceptors ) ;
@@ -53,7 +53,7 @@ class Request {
53
53
} else {
54
54
if ( response . statusCode == 200 ) {
55
55
if ( this . interceptor . response && typeof this . interceptor . response === 'function' ) {
56
- let resInterceptors = this . interceptor . response ( response . data ) ;
56
+ let resInterceptors = await this . interceptor . response ( response . data ) ;
57
57
if ( resInterceptors !== false ) {
58
58
resolve ( resInterceptors ) ;
59
59
} else {
0 commit comments