I use
axios.interceptors.request.use(config => {
if (getToken()) {
config.headers["token"] = getToken() // token-- ["X-Token"]key
} else {
console.log("token")
}
const role = store.state.permission.roleList.find(role => role.url === config.url && role.confirmFlag === _const.YES)
console.log(role)
if (true) {
MessageBox("?", "", {
confirmButtonText: "",
cancelButtonText: "",
type: "warning"
}).then(() => {
config.headers["confirmUser"] = "wcsconfirmuser"
config.headers["confirmPwd"] = "123456"
// Do something before request is sent
return config
})
} else {
return config
}
})
you can"t send a request like this