我正在构建一个react原生应用程序,您可以在其中订购物品。
但是,我无法发布到我的其他可模拟API(发布的限制)
我正在使用expo开发我的应用程序
我期待什么:
我得到了什么:
未损坏的承诺拒绝(id:0);错误:网络错误
handleSubmit = () => {
this.setState({
orderRestrauntId: this.props.RestrauntId,
orderValue: this.state.value,
orderProducts: this.props.products,
orderTotalPrice: this.props.totalPrice,
})
axios.post(
'https://demo3381137.mockable.io/orders',
{
"orderId": "1",
"RestrauntId": this.state.orderRestrauntId,
"orderKey": "F3SAR566T",
"userId": "1",
"paymentStatus": "approved",
"preparing": "approved",
"orderStatus": "approved",
"paymentMethod": this.state.orderValue,
"totalPrice": this.state.orderTotalPrice,
"order": [
{
"product" : "burger",
"qty" : "5"
},
{
"product" : "pizza",
"qty" : "5"
},
{
"product" : "fries",
"qty" : "5"
}
]
},
{
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
}
}
);
console.log('submit');
}