Reputation: 3
I am new and I'm lost as to why my PUT request did not inserting the data into the database.
const orderId = JSON.stringify(1000 + Math.floor(Math.random() * 5000));
await fetch(`http://0.0.0.0:9010/fdb/pos/collection/order/${orderId}`, {
"method": "PUT",
"headers": {
"Content-Type": "application/json"
},
"body": JSON.stringify({
merchantId,
"_id": orderId,
"lineItems": cartItems,
"paymentIntent": paymentIntent.id,
"status": "stripePendingPayment",
"rejectedReason": "",
"totalPrice": String(basketTotalPrice * 100),
"updatedTs": new Date(),
"createdTs": new Date()
})
}).then(r => console.log(r.status));
Log returned status 200 but no data. It works with POST method but not PUT. Does anyone have any idea as to why that is?
Any input is welcome with thanks in advance.
Upvotes: 0
Views: 1312
Reputation: 485
PUT is for updating the data, maybe this method just says you updated succesfully the content.
Upvotes: 0