I’m using mockAPI to create an api for my project, but when i use .POST method to send data, mockAPI doesn’t receive it.
Data I send
const product = {
"address": "commune, district, province",
"date": "24/10/2022",
"email": "[email protected]",
"id": 3879042658,
"name": "Mr. Cabin",
"note": "please take care",
"phone": "1234567890",
"products": [
{id: 1, soLuong: 3}
]
}]
I use fetch to send data
function addOrders() {
fetch('API-MOCKAPI URL', {
method: 'POST',
body: JSON.stringify(product)
.then(res => res.json())
.then(result => {
console.log(result)
})
}
Response I receive
{id: 64, name: 'name 3', email: 'email 3', phone: 'phone 3', address: 'address 3', product: []}