@@ -12,7 +12,7 @@ class Request {
1212 // 检查请求拦截
1313 if ( this . interceptor . request && typeof this . interceptor . request === 'function' ) {
1414 let tmpConfig = { } ;
15- let interceptorReuest = this . interceptor . request ( options ) ;
15+ let interceptorReuest = await this . interceptor . request ( options ) ;
1616 if ( interceptorReuest === false ) {
1717 return false ;
1818 }
@@ -27,7 +27,7 @@ class Request {
2727 options . method = options . method || this . config . method ;
2828
2929 return new Promise ( ( resolve , reject ) => {
30- options . complete = ( response ) => {
30+ options . complete = async ( response ) => {
3131 // 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
3232 uni . hideLoading ( ) ;
3333 // 清除定时器,如果请求回来了,就无需loading
@@ -36,7 +36,7 @@ class Request {
3636 if ( this . config . originalData ) {
3737 // 判断是否存在拦截器
3838 if ( this . interceptor . response && typeof this . interceptor . response === 'function' ) {
39- let resInterceptors = this . interceptor . response ( response ) ;
39+ let resInterceptors = await this . interceptor . response ( response ) ;
4040 // 如果拦截器不返回false,就将拦截器返回的内容给this.$u.post的then回调
4141 if ( resInterceptors !== false ) {
4242 resolve ( resInterceptors ) ;
@@ -51,7 +51,7 @@ class Request {
5151 } else {
5252 if ( response . statusCode == 200 ) {
5353 if ( this . interceptor . response && typeof this . interceptor . response === 'function' ) {
54- let resInterceptors = this . interceptor . response ( response . data ) ;
54+ let resInterceptors = await this . interceptor . response ( response . data ) ;
5555 if ( resInterceptors !== false ) {
5656 resolve ( resInterceptors ) ;
5757 } else {
0 commit comments