From f2451beed670dc697aa2026b2df6ad1ad1e90da2 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 9 Dec 2024 15:00:45 +0700
Subject: <iman> update pengajuan tempo

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 82b64df7..58794b31 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -177,7 +177,6 @@ const PengajuanTempo = () => {
           'GET',
           `/api/v1/partner/detail-tempo/${auth.parentId}`
         );
-        console.log('original data', dataPaymentTerm);
         const transformedData = transformKeysToCamelCase(dataPaymentTerm);
         setBigData(transformedData);
       } catch (error) {
@@ -216,7 +215,6 @@ const PengajuanTempo = () => {
                   ? JSON.stringify(bigData[key]) // Untuk objek atau array
                   : String(bigData[key]); // Untuk tipe primitif
               // Kirim data yang sudah diubah ke string ke stepDivsUpdateForm
-              console.log('key', key, stringData);
               stepDivsUpdateForm[currentStep](key, stringData);
             }
           });
@@ -369,8 +367,10 @@ const PengajuanTempo = () => {
 
     // Periksa perubahan
     const toastId = toast.loading('Mengirimkan formulir pengajuan tempo...');
-    if (!isSupplierDataChanged(productOrder, bigData.supplierIds)) {
-      return;
+    if (bigData.supplierIds) {
+      if (!isSupplierDataChanged(productOrder, bigData.supplierIds)) {
+        return;
+      }
     }
 
     setIsLoading(true);
@@ -456,9 +456,9 @@ const PengajuanTempo = () => {
 
       if (address4?.id) {
         const isUpdated = await editAuthTempo();
-        toast.dismiss(toastId);
         if (isUpdated?.user) {
           setAuth(isUpdated.user);
+          toast.dismiss(toastId);
           setIsLoading(false);
           toast.success('Pengajuan tempo berhasil dilakukan');
           toast.success('Berhasil mengubah status akun', { duration: 1000 });
@@ -502,9 +502,6 @@ const PengajuanTempo = () => {
   const handleCheckChange = (checked) => {
     setIsCheckedTNC(checked);
   };
-  console.log('formSupplier', formSupplier);
-  console.log('!hassavedata', hasSavedata);
-  console.log('isCheckedTNC', isCheckedTNC);
   return (
     <>
       <div className='container flex flex-col items-center '>
-- 
cgit v1.2.3

