From 71ca9d6c85871b6bcb2976ed4911032aab4d32e7 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Thu, 24 Apr 2025 13:53:32 +0700
Subject: fixing revisi renca

---
 src/lib/checkout/components/SectionExpedition.jsx | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

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

diff --git a/src/lib/checkout/components/SectionExpedition.jsx b/src/lib/checkout/components/SectionExpedition.jsx
index 22d8df32..b017c82e 100644
--- a/src/lib/checkout/components/SectionExpedition.jsx
+++ b/src/lib/checkout/components/SectionExpedition.jsx
@@ -29,7 +29,7 @@ function reverseMappingCourier(couriersOdoo, couriers, includeInstant = false) {
   // Buat peta courier berdasarkan nama courier dari couriers
   const courierMap = couriers.reduce((acc, item) => {
     const { courier_name, courier_code, courier_service_code } = item;
-    const key = courier_name.toLowerCase();
+    const key = courier_code.toLowerCase();
 
     if (
       !includeInstant &&
@@ -165,14 +165,11 @@ function mappingCourier(couriersOdoo, couriers, notIncludeInstant = false) {
 
 export default function SectionExpedition({ products }) {
   const { addressMaps, coordinate, postalCode } = useAddress();
-  const { control, handleSubmit } = useForm();
   const [serviceOptions, setServiceOptions] = useState([]);
   const [isOpen, setIsOpen] = useState(false);
-  const [selectedE, setIsOpenCourier] = useState(false);
   const [onFocusSelectedCourier, setOnFocuseSelectedCourier] = useState(false);
   const [couriers, setCouriers] = useState(null);
   const [slaProducts, setSlaProducts] = useState(null);
-  const [addHolidays, setAddHolidays] = useState(0);
   const [savedServiceOptions, setSavedServiceOptions] = useState([]);
 
   const {
@@ -270,8 +267,8 @@ export default function SectionExpedition({ products }) {
   );
 
   useEffect(() => {
+    const instant = slaProducts?.includeInstant || false;
     if (data) {
-      const instant = slaProducts?.includeInstant || false;
       const couriers = reverseMappingCourier(
         listExpedisi,
         data?.data?.pricing,
@@ -279,7 +276,7 @@ export default function SectionExpedition({ products }) {
       );
       setCouriers(couriers);
     }
-  }, [data]);
+  }, [data, slaProducts]);
 
   const onCourierChange = (code) => {
     setIsOpen(false);
@@ -315,11 +312,6 @@ export default function SectionExpedition({ products }) {
     }
   };
 
-  const onSubmit = (data) => {
-    1;
-    console.log(data);
-  };
-
   const handleOnFocuse = (value) => {
     setOnFocuseSelectedCourier(!value);
     setIsOpen(false);
@@ -340,7 +332,7 @@ export default function SectionExpedition({ products }) {
 }, [serviceOptions]);
 
   return (
-    <form onSubmit={handleSubmit(onSubmit)}>
+    <form >
       <div className='px-4 py-2'>
         <div className='flex justify-between items-center'>
           <div className='font-medium'>Pilih Ekspedisi: </div>
-- 
cgit v1.2.3

