web/src/utils/request.js: Fix Server 返回非 JSON 响应数据时导致错误弹窗 (#2049)
This commit is contained in:
parent
44751357b4
commit
a5e1170af0
|
|
@ -77,6 +77,9 @@ service.interceptors.response.use(
|
|||
if (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.headers.msg) {
|
||||
response.data.msg = decodeURI(response.headers.msg)
|
||||
|
|
|
|||
Loading…
Reference in New Issue