'how to restock after successful update Quantity in node.js?

javascript as you can see my visualstudio code i am trying to restoke the product but i am struggeling to do it in javascript

const restock = (e) => { e.preventDefault(); let updatedQuantity = parseInt(+product.quantity) + parseInt(e.target.upQuantity.value); let newInventory = { name, img, description, price, quantity: updatedQuantity, supplierName }; setProduct(newInventory);

    const url = `http://localhost:5000/product/${productId}`
    fetch(url, {
        method: 'PUT',
        body: JSON.stringify(newInventory),
        headers: {
            'Content-Type': 'application/json',
        }
    })
        .then((res) => res.json())
        .then(data => {
            toast('Delivery Success!')
        })
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source