web/src/utils/request.js: Fix Server 返回非 JSON 响应数据时导致错误弹窗 (#2049)
This commit is contained in:
@@ -77,6 +77,9 @@ service.interceptors.response.use(
|
|||||||
if (response.headers['new-token']) {
|
if (response.headers['new-token']) {
|
||||||
userStore.setToken(response.headers['new-token'])
|
userStore.setToken(response.headers['new-token'])
|
||||||
}
|
}
|
||||||
|
if (typeof response.data.code === 'undefined') {
|
||||||
|
return response
|
||||||
|
}
|
||||||
if (response.data.code === 0 || response.headers.success === 'true') {
|
if (response.data.code === 0 || response.headers.success === 'true') {
|
||||||
if (response.headers.msg) {
|
if (response.headers.msg) {
|
||||||
response.data.msg = decodeURI(response.headers.msg)
|
response.data.msg = decodeURI(response.headers.msg)
|
||||||
|
Reference in New Issue
Block a user