File tree Expand file tree Collapse file tree 3 files changed +3
-6
lines changed Expand file tree Collapse file tree 3 files changed +3
-6
lines changed Original file line number Diff line number Diff line change 1
1
ENV = ' development'
2
2
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(
109
109
// Add a response interceptor
110
110
_axios . interceptors . response . use (
111
111
async res => {
112
- console . log ( 'res--------' , res )
113
112
let { code, message } = res . data // eslint-disable-line
114
113
if ( res . status . toString ( ) . charAt ( 0 ) === '2' ) {
115
114
return res . data
@@ -138,12 +137,11 @@ _axios.interceptors.response.use(
138
137
return resolve ( result )
139
138
}
140
139
}
141
- // 如果本次请求添加了 handleError: true,用户自己try catch,框架不做处理
140
+ // 第一种情况:默认直接提示后端返回的异常信息;特殊情况: 如果本次请求添加了 handleError: true,用户自己try catch,框架不做处理
142
141
if ( res . config . handleError ) {
143
142
return reject ( res )
144
143
}
145
- console . log ( 'message' , message )
146
- // 如果本次请求添加了 showBackend: true, 弹出后端返回错误信息
144
+ // 第二种情况:采用前端自己的一套异常提示信息;特殊情况:如果本次请求添加了 showBackend: true, 弹出后端返回错误信息。
147
145
if ( Config . useFrontEndErrorMsg && ! res . config . showBackend ) {
148
146
// 弹出前端自定义错误信息
149
147
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 {
11
11
method : 'post' ,
12
12
url : 'v1/book' ,
13
13
data,
14
- handleError : true ,
15
14
} )
16
15
}
17
16
You can’t perform that action at this time.
0 commit comments