这就是我派 Postman 来的方式
{
"isAdmin": true,
"type": "shoes",
"description": "true"
}
这是我如何发送vue
async onAddCategory() {
let data = new FormData();
data.append("type", this.type);
data.append("isAdmin", this.isAdmin);
data.append("description", this.description);
const response = await axios
.post("http://localhost:4000/api/categories", data,
})
.then(response => {
console.log(response);
})
.catch(err => {
console.log(err);
});
},
这是我的控制台,显示“isAdmin”:真的,
{
"_id": "640f4e785d1e1c8d7c1be439",
"isAdmin": true,
"name": "t",
"email": "t@gmail.com",
"password": "$2a$10$O1hMb2Tc7mdK7iD4gbZ/VeV1htualyj0Fry86pt6stv7boIk.0ft2",
"__v": 0
}
由于isAdmin = true无法通过,我不断地被取消授权
1条答案
按热度按时间h6my8fg21#
用这个
而不是数据。附加