summaryrefslogtreecommitdiff
path: root/src-migrate/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src-migrate/modules')
-rw-r--r--src-migrate/modules/cart/components/ItemSelect.tsx8
-rw-r--r--src-migrate/modules/product-detail/components/AddToCart.tsx10
-rw-r--r--src-migrate/modules/product-promo/components/AddToCart.tsx10
3 files changed, 25 insertions, 3 deletions
diff --git a/src-migrate/modules/cart/components/ItemSelect.tsx b/src-migrate/modules/cart/components/ItemSelect.tsx
index 1d8886a2..b904a1de 100644
--- a/src-migrate/modules/cart/components/ItemSelect.tsx
+++ b/src-migrate/modules/cart/components/ItemSelect.tsx
@@ -21,7 +21,13 @@ const CartItemSelect = ({ item }: Props) => {
if (typeof auth !== 'object') return
setIsLoad(true)
- await upsertUserCart(auth.id, item.cart_type, item.id, item.quantity, e.target.checked)
+ await upsertUserCart({
+ userId: auth.id,
+ type: item.cart_type,
+ id: item.id,
+ qty: item.quantity,
+ selected: e.target.checked
+ })
await loadCart(auth.id)
setIsLoad(false)
}
diff --git a/src-migrate/modules/product-detail/components/AddToCart.tsx b/src-migrate/modules/product-detail/components/AddToCart.tsx
index ebd6be7a..097db98a 100644
--- a/src-migrate/modules/product-detail/components/AddToCart.tsx
+++ b/src-migrate/modules/product-detail/components/AddToCart.tsx
@@ -36,7 +36,15 @@ const AddToCart = ({
) return;
toast.promise(
- upsertUserCart(auth.id, 'product', variantId, quantity, true, source),
+ upsertUserCart({
+ userId: auth.id,
+ type: 'product',
+ id: variantId,
+ qty: quantity,
+ selected: true,
+ source: source,
+ qtyAppend: true
+ }),
{
loading: { title: 'Menambahkan ke keranjang', description: 'Mohon tunggu...' },
success: { title: 'Menambahkan ke keranjang', description: 'Berhasil menambahkan ke keranjang belanja' },
diff --git a/src-migrate/modules/product-promo/components/AddToCart.tsx b/src-migrate/modules/product-promo/components/AddToCart.tsx
index 95d275fc..192dd231 100644
--- a/src-migrate/modules/product-promo/components/AddToCart.tsx
+++ b/src-migrate/modules/product-promo/components/AddToCart.tsx
@@ -29,7 +29,15 @@ const ProductPromoAddToCart = ({ promotion }: Props) => {
if (status === 'success') return
setStatus('loading')
- await upsertUserCart(auth.id, 'promotion', promotion.id, 1, true)
+ await upsertUserCart({
+ userId: auth.id,
+ type: 'promotion',
+ id: promotion.id,
+ qty: 1,
+ selected: true,
+ source: 'add_to_cart',
+ qtyAppend: true
+ })
setStatus('idle')
toast({