April 2020
Intermediate to advanced
716 pages
18h 55m
English
If a seller chooses to update the status of an ordered product so that it has a value other than Cancelled or Processing, we will need to invoke an API that will update the order in the database with this changed product status. So, when a seller selects other status values from the dropdown for a specific product in the order, we will call the update fetch method inside the handleStatusChange method, as shown in the following code.
mern-marketplace/client/order/ProductOrderEdit.js:
update({ shopId: props.shopId }, { t: jwt.token }, { cartItemId: product._id, status: event.target.value }) .then((data) => { if (data.error) { setValues({ ...values, error: "Status not updated, try again" ...