【发布时间】:2021-01-05 14:53:37
【问题描述】:
请帮忙... 如果我将数据作为数据集发送到后端(如下例所示),服务器会毫无问题地接受数据。
axios.post('http://localhost:8080/repair',
{
description: 'Descriptiony',
registrationNo: '8899',
expire: '2020-12-13',
startDate: '2020-11-29',
status: 'Red',
errorCode: 'e333',
repairDescription: 'Reparatur',
spitzName: 'Gumowa Kaczka'
})
.then((response) => {
console.log(response);
}, (error) => {
console.log(error);
});
}
但是,如果我将数据作为对象“this.props”发送,那么不幸的是,我从服务器收到错误 500。 这是 this.props 的代码
continue = e => {
e.preventDefault();
console.log(this.props);
axios.post('http://localhost:8080/repair', this.props,
)
.then((response) => {
console.log(response);
console.log(this.props);
}, (error) => {
console.log(error.message);
});
this.props.nextStep();
};
我尝试使用 console.log 查看数据,但似乎是正确的。 非常感谢您的帮助。
【问题讨论】:
-
HTTP 500 是内部服务器错误,意思是“服务器遇到了阻止它完成请求的意外情况。”。你为什么要发布你的客户端代码?你应该看看你的后端为什么会遇到错误。
标签: javascript reactjs forms server axios