Skip to content

Commit 7a6939e

Browse files
author
piexlmax
committed
调整axios封装
1 parent 2863f18 commit 7a6939e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

web/src/utils/request.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ service.interceptors.request.use(
3636
}
3737
const token = store.getters['user/token']
3838
const user = store.getters['user/userInfo']
39-
config.data = JSON.stringify(config.data)
4039
config.headers = {
4140
'Content-Type': 'application/json',
4241
'x-token': token,
43-
'x-user-id': user.ID
42+
'x-user-id': user.ID,
43+
...config.headers
4444
}
4545
return config
4646
},
@@ -70,7 +70,7 @@ service.interceptors.response.use(
7070
} else {
7171
ElMessage({
7272
showClose: true,
73-
message: response.data.msg||decodeURI(response.headers.msg),
73+
message: response.data.msg || decodeURI(response.headers.msg),
7474
type: 'error'
7575
})
7676
if (response.data.data && response.data.data.reload) {

0 commit comments

Comments
 (0)