1 / axios.js file
export function post(url,data){
return new Promise((resolve,reject) => {
axios.post(url,data)
.then(response => {
resolve(response.data);
},err => {
reject(err)
}).catch(err => {
reject(err.data)
})
})
}
2 / login.vue file
methods: {
submitForm(formName){
this.$refs[formName].validate((valid) => {
if(valid) {
this.post("",{
username: this.loginForm.username,
password: this.loginForm.password
})
.then( res=>{
console.log(res)
})
}else{
console.log("Error Submit!!")
}
})
}
},
< hr >
Why the login result is
:.
< hr >
what is the problem? How should we solve this problem?