From a3d4259a70ca24dadf1e86d392efc05818d9327e Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Wed, 26 Jul 2023 13:21:07 +0700
Subject: fixing jika beli langsung

---
 src/lib/checkout/components/Checkout.jsx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'src/lib/checkout/components/Checkout.jsx')

diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index 11a14e31..17616938 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -34,12 +34,13 @@ const { getProductsCheckout } = require('../api/checkoutApi')
 
 const Checkout = () => {
   const router = useRouter()
+  const query = router.query.source ?? null
   const auth = useAuth()
 
   const [activeVoucher, SetActiveVoucher] = useState(null)
 
   const { data: cartCheckout } = useQuery('cartCheckout-' + activeVoucher, () =>
-    getProductsCheckout(activeVoucher)
+    getProductsCheckout(activeVoucher, query)
   )
 
   const [selectedAddress, setSelectedAddress] = useState({
@@ -298,6 +299,9 @@ const Checkout = () => {
       voucher: activeVoucher,
       type: 'sale_order'
     }
+    if(query){
+      data.source = 'buy'
+    }
     if (poNumber.current.value) data.po_number = poNumber.current.value
     if (typeof file !== 'undefined') data.po_file = await getFileBase64(file)
 
-- 
cgit v1.2.3

