@@ -14,7 +14,7 @@ class Request {
1414 // 检查请求拦截
1515 if ( this . interceptor . request && typeof this . interceptor . request === 'function' ) {
1616 let tmpConfig = { } ;
17- let interceptorReuest = this . interceptor . request ( options ) ;
17+ let interceptorReuest = await this . interceptor . request ( options ) ;
1818 if ( interceptorReuest === false ) {
1919 return false ;
2020 }
@@ -29,7 +29,7 @@ class Request {
2929 options . method = options . method || this . config . method ;
3030
3131 return new Promise ( ( resolve , reject ) => {
32- options . complete = ( response ) => {
32+ options . complete = async ( response ) => {
3333 // 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
3434 uni . hideLoading ( ) ;
3535 // 清除定时器,如果请求回来了,就无需loading
@@ -38,7 +38,7 @@ class Request {
3838 if ( this . config . originalData ) {
3939 // 判断是否存在拦截器
4040 if ( this . interceptor . response && typeof this . interceptor . response === 'function' ) {
41- let resInterceptors = this . interceptor . response ( response ) ;
41+ let resInterceptors = await this . interceptor . response ( response ) ;
4242 // 如果拦截器不返回false,就将拦截器返回的内容给this.$u.post的then回调
4343 if ( resInterceptors !== false ) {
4444 resolve ( resInterceptors ) ;
@@ -53,7 +53,7 @@ class Request {
5353 } else {
5454 if ( response . statusCode == 200 ) {
5555 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 ) ;
5757 if ( resInterceptors !== false ) {
5858 resolve ( resInterceptors ) ;
5959 } else {
0 commit comments