File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11ENV = ' development'
22
3- VUE_APP_BASE_URL = ' http://pedro.7yue.pro /'
3+ VUE_APP_BASE_URL = ' http://localhost:5000 /'
Original file line number Diff line number Diff line change @@ -109,7 +109,6 @@ _axios.interceptors.request.use(
109109// Add a response interceptor
110110_axios . interceptors . response . use (
111111 async res => {
112- console . log ( 'res--------' , res )
113112 let { code, message } = res . data // eslint-disable-line
114113 if ( res . status . toString ( ) . charAt ( 0 ) === '2' ) {
115114 return res . data
@@ -138,12 +137,11 @@ _axios.interceptors.response.use(
138137 return resolve ( result )
139138 }
140139 }
141- // 如果本次请求添加了 handleError: true,用户自己try catch,框架不做处理
140+ // 第一种情况:默认直接提示后端返回的异常信息;特殊情况: 如果本次请求添加了 handleError: true,用户自己try catch,框架不做处理
142141 if ( res . config . handleError ) {
143142 return reject ( res )
144143 }
145- console . log ( 'message' , message )
146- // 如果本次请求添加了 showBackend: true, 弹出后端返回错误信息
144+ // 第二种情况:采用前端自己的一套异常提示信息;特殊情况:如果本次请求添加了 showBackend: true, 弹出后端返回错误信息。
147145 if ( Config . useFrontEndErrorMsg && ! res . config . showBackend ) {
148146 // 弹出前端自定义错误信息
149147 const errorArr = Object . entries ( ErrorCode ) . filter ( v => v [ 0 ] === code . toString ( ) )
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ class Book {
1111 method : 'post' ,
1212 url : 'v1/book' ,
1313 data,
14- handleError : true ,
1514 } )
1615 }
1716
You can’t perform that action at this time.
0 commit comments