use axios to send post request for background interface
this.$ajax.post("/user/login",{
username: user,
password: pass
})
.then(function (response) {
console.log(response)
console.log(response.data)
})
.catch(function (error) {
console.log(error);
});
axios filter settings are as follows:
const service = axios.create({
baseURL: process.env.BASE_API,
timeout: 15000
})
service.interceptors.request.use(config => {
if (getToken) {
config.headers["Authorization"] = getToken()
}
return config
}, error => {
console.log(error)
Promise.reject(error)
})
if the request is successful, 200
is returned.
:
reponseresponse.data:
:
ask the boss for help, thank you.