Skip to content

Commit 96262b2

Browse files
committed
fix(optimize the experience):
1 parent 0de051f commit 96262b2

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
ENV = 'development'
22

3-
VUE_APP_BASE_URL = 'http://pedro.7yue.pro/'
3+
VUE_APP_BASE_URL = 'http://localhost:5000/'

src/lin/plugins/axios.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff 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())

src/models/book.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class Book {
1111
method: 'post',
1212
url: 'v1/book',
1313
data,
14-
handleError: true,
1514
})
1615
}
1716

0 commit comments

Comments
 (0)