summaryrefslogtreecommitdiff
path: root/src/core/utils/cart.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/utils/cart.js')
-rw-r--r--src/core/utils/cart.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/utils/cart.js b/src/core/utils/cart.js
index eb411dd3..16befdf7 100644
--- a/src/core/utils/cart.js
+++ b/src/core/utils/cart.js
@@ -35,18 +35,18 @@ const addCart = async (product_id, qty, selected, programLineId = null) => {
'product_id' : product_id,
'qty' : qty,
'selected' : selected,
+ 'program_line_id' : programLineId
}
- if(programLineId){
- data += {
- 'program_line_id' : programLineId,
- }
- }
+
const id = getAuth()?.id
const cartAdd = await odooApi(
'POST',
`/api/v1/user/${id}/cart/create-or-update`,
data
)
+
+ return true
+
}
const getCartApi = async () => {
@@ -94,12 +94,12 @@ const getItemCart = ({ productId }) => {
* @param {boolean} [options.selected=false] - The new selected status of the product in the cart. Default is `false`.
* @returns {boolean} - Returns `true`.
*/
-const updateItemCart = ({ productId, quantity, selected = false , programLineId}) => {
+const updateItemCart = async ({ productId, quantity, selected = false , programLineId}) => {
let cart = getCart()
quantity = parseInt(quantity)
cart[productId] = { productId, quantity, selected }
setCart(cart)
- addCart(productId, quantity, selected, programLineId)
+ await addCart(productId, quantity, selected, programLineId)
return true
}