From 68e1d6e55b6d38d86c2b3332268fb508de0a2db8 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 16 Jan 2025 09:13:04 +0700 Subject: comment compres file --- src/lib/pengajuan-tempo/component/Dokumen.jsx | 45 +++++++++++----------- .../pengajuan-tempo/component/PengajuanTempo.jsx | 2 +- 2 files changed, 24 insertions(+), 23 deletions(-) (limited to 'src/lib') diff --git a/src/lib/pengajuan-tempo/component/Dokumen.jsx b/src/lib/pengajuan-tempo/component/Dokumen.jsx index 00bb715a..f986d47a 100644 --- a/src/lib/pengajuan-tempo/component/Dokumen.jsx +++ b/src/lib/pengajuan-tempo/component/Dokumen.jsx @@ -44,28 +44,29 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { } // Check for file size - if (file.size > 500000) { - try { - const toastId = toast.loading('mencoba mengompresi file...'); - // Compress image file - const options = { - maxSizeMB: 0.5, // Target size in MB - maxWidthOrHeight: 1920, // Adjust as needed - useWebWorker: true, - }; - const compressedFile = await imageCompression(file, options); - toast.success('berhasil mengompresi file', { duration: 4000 }); - // Convert compressed file to Base64 - fileBase64 = await getFileBase64(compressedFile); - updateFormDokumen( - name, - compressedFile.name, - fileExtension, - fileBase64 - ); - } catch (error) { - toast.error('Gagal mengompresi file', { duration: 4000 }); - } + if (file.size > 2000000) { + // try { + // const toastId = toast.loading('mencoba mengompresi file...'); + // // Compress image file + // const options = { + // maxSizeMB: 0.5, // Target size in MB + // maxWidthOrHeight: 1920, // Adjust as needed + // useWebWorker: true, + // }; + // const compressedFile = await imageCompression(file, options); + // toast.success('berhasil mengompresi file', { duration: 4000 }); + // // Convert compressed file to Base64 + // fileBase64 = await getFileBase64(compressedFile); + // updateFormDokumen( + // name, + // compressedFile.name, + // fileExtension, + // fileBase64 + // ); + // } catch (error) { + // toast.error('Gagal mengompresi file', { duration: 4000 }); + // } + toast.error('Max File Upload 2MB', { duration: 4000 }); } else { // Convert file to Base64 fileBase64 = await getFileBase64(file); diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx index 018668b6..5bef5134 100644 --- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx +++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx @@ -392,7 +392,7 @@ const PengajuanTempo = () => { // Periksa perubahan const toastId = toast.loading('Mengirimkan formulir pengajuan tempo...'); - if (bigData.supplierIds) { + if (bigData?.supplierIds) { if (!isSupplierDataChanged(productOrder, bigData.supplierIds)) { return; } -- cgit v1.2.3