summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortrisusilo <tri.susilo@altama.co.id>2023-07-26 06:22:16 +0000
committertrisusilo <tri.susilo@altama.co.id>2023-07-26 06:22:16 +0000
commit0e8d4375dad12cbf07f8ff484ef547c15ae4c0cc (patch)
tree00b211a28214e21d4498e5002e3749003e7be0e5 /src
parent02d71887bb060cda71c487264a4edaa1e364cfbc (diff)
parentd6761519478ba351099b5d60083f318ad0812305 (diff)
Merged in Hotfix/action_click_button_beli (pull request #25)
ketinggalan cart
Diffstat (limited to 'src')
-rw-r--r--src/core/utils/cart.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/utils/cart.js b/src/core/utils/cart.js
index 16befdf7..dcb104f9 100644
--- a/src/core/utils/cart.js
+++ b/src/core/utils/cart.js
@@ -30,12 +30,13 @@ const setCart = (cart) => {
return false
}
-const addCart = async (product_id, qty, selected, programLineId = null) => {
+const addCart = async (product_id, qty, selected, programLineId = null, source) => {
const data = {
'product_id' : product_id,
'qty' : qty,
'selected' : selected,
- 'program_line_id' : programLineId
+ 'program_line_id' : programLineId,
+ 'source' : source
}
const id = getAuth()?.id
@@ -94,12 +95,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 = async ({ productId, quantity, selected = false , programLineId}) => {
+const updateItemCart = async ({ productId, quantity, selected = false , programLineId, source}) => {
let cart = getCart()
quantity = parseInt(quantity)
cart[productId] = { productId, quantity, selected }
setCart(cart)
- await addCart(productId, quantity, selected, programLineId)
+ await addCart(productId, quantity, selected, programLineId, source)
return true
}