From 0f84963214ee6dc5b5a44d945540826a66bec9e0 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 11 Dec 2024 11:51:45 +0700
Subject: <iman> update pengajuan tempo

---
 src/lib/address/components/EditAddress.jsx | 40 +-----------------------------
 1 file changed, 1 insertion(+), 39 deletions(-)

(limited to 'src/lib/address/components/EditAddress.jsx')

diff --git a/src/lib/address/components/EditAddress.jsx b/src/lib/address/components/EditAddress.jsx
index dd5c27fd..b98ab7b4 100644
--- a/src/lib/address/components/EditAddress.jsx
+++ b/src/lib/address/components/EditAddress.jsx
@@ -35,7 +35,6 @@ const EditAddress = ({ id, defaultValues }) => {
   const [cities, setCities] = useState([]);
   const [districts, setDistricts] = useState([]);
   const [subDistricts, setSubDistricts] = useState([]);
-  const [isZipTrue, setIsZipTrue] = useState(false);
 
   useEffect(() => {
     const loadProfile = async () => {
@@ -53,7 +52,7 @@ const EditAddress = ({ id, defaultValues }) => {
 
   useEffect(() => {
     const loadStates = async () => {
-      let dataStates = await stateApi();
+      let dataStates = await stateApi({ tempo: false });
       dataStates = dataStates.map((state) => ({
         value: state.id,
         label: state.name,
@@ -128,44 +127,7 @@ const EditAddress = ({ id, defaultValues }) => {
       loadSubDistricts();
     }
   }, [watchDistrict, setValue, getValues]);
-
-  const watchZip = watch('zip');
   const onSubmitHandler = async (values) => {
-    if (watchZip) {
-      const loadZip = async () => {
-        try {
-          const response = await fetch(
-            `https://alamat.thecloudalert.com/api/cari/index/?keyword=${watchZip}`
-          );
-
-          if (!response.ok) {
-            toast.error('Gagal memuat data alamat pos.');
-            setValue('zip', '');
-            return false;
-          }
-
-          const result = await response.json();
-          console.log('result', result);
-
-          if (result.length === 0) {
-            toast.error('Alamat pos salah');
-            setValue('zip', '');
-            return false;
-          }
-
-          return true; // Jika valid
-        } catch (error) {
-          toast.error('Terjadi kesalahan saat memeriksa alamat pos.');
-          console.error('Error:', error);
-          return false;
-        }
-      };
-
-      const isValidZip = await loadZip();
-      if (!isValidZip) {
-        return; // Menghentikan eksekusi jika alamat salah
-      }
-    }
     const data = {
       ...values,
       phone: values.mobile,
-- 
cgit v1.2.3

