Untitled
unknown
javascript
a year ago
815 B
5
Indexable
Never
const decreaseQuantity = async (productId, quantity) => { try { const response = await axios.post("http://localhost:5174/cart/updatecart", { productId, quantity: qty - 1, // use the updated value here userID: useGetUserID(), }); if (qty > 1) { setqty(qty => qty - 1); } console.log(response.data); } catch (err) { console.error(err.response.data); } }; const increaseQuantity = async (productId, quantity) => { try { const response = await axios.post("http://localhost:5174/cart/updatecart", { productId, quantity: qty + 1, // use the updated value here userID: useGetUserID(), }); if (qty >= 1) { setqty(qty => qty + 1); } console.log(response.data); } catch (err) { console.error(err.response.data); } };