summaryrefslogtreecommitdiff
path: root/src/core/utils
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-07-26 13:24:09 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-07-26 13:24:09 +0700
commitd6761519478ba351099b5d60083f318ad0812305 (patch)
tree4973cb16e9c0e03b2956f7f700fe51b3593b626f /src/core/utils
parenta3d4259a70ca24dadf1e86d392efc05818d9327e (diff)
ketinggalan cart
Diffstat (limited to 'src/core/utils')
-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
}