Browse Source

头部信息增加用户id

main
QM303176530 4 years ago
parent
commit
95444a6eb5
  1. 16
      web/src/utils/request.js

16
web/src/utils/request.js

@ -21,21 +21,23 @@ const showLoading = () => {
}
const closeLoading = () => {
acitveAxios--
if (acitveAxios <= 0) {
clearTimeout(timer)
loadingInstance && loadingInstance.close()
}
acitveAxios--
if (acitveAxios <= 0) {
clearTimeout(timer)
loadingInstance && loadingInstance.close()
}
//http request 拦截器
}
//http request 拦截器
service.interceptors.request.use(
config => {
showLoading()
const token = store.getters['user/token']
const user = store.getters['user/userInfo']
config.data = JSON.stringify(config.data);
config.headers = {
'Content-Type': 'application/json',
'x-token': token
'x-token': token,
'x-user-id':user.ID
}
return config;
},

Loading…
Cancel
Save