From ed679c9b8ea85e8f181cf67465effc4b5ff1a7bc Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 1 Oct 2024 09:42:51 +0700
Subject: <iman> update code has npwp atau sppkp

---
 src-migrate/modules/register/components/FormBisnis.tsx | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

(limited to 'src-migrate/modules/register/components/FormBisnis.tsx')

diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx
index 16747ff3..9e5a0c07 100644
--- a/src-migrate/modules/register/components/FormBisnis.tsx
+++ b/src-migrate/modules/register/components/FormBisnis.tsx
@@ -351,9 +351,11 @@ const form: React.FC<FormProps> = ({
   useEffect(() => {
     const checkUrlNPWP = async (url: string | URL | Request) => {
       try {
-        const response = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/chek/npwp/${auth?.parentId}`;
-
-        return response; // Returns true if status is 200-299
+        const response = await odooApi(
+          'GET',
+          `/api/v1/user/chek/npwp/${auth?.parentId}`
+        );
+        return response.status; // Returns true if status is 200-299
       } catch (error) {
         console.error('Error accessing URL:', url, error);
         return false;
@@ -361,9 +363,12 @@ const form: React.FC<FormProps> = ({
     };
     const checkUrlSPPKP = async (url: string | URL | Request) => {
       try {
-        const response = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/chek/sppkp/${auth?.parentId}`;
+        const response = await odooApi(
+          'GET',
+          `/api/v1/user/chek/sppkp/${auth?.parentId}`
+        );
 
-        return response; // Returns true if status is 200-299
+        return response.status; // Returns true if status is 200-299
       } catch (error) {
         console.error('Error accessing URL:', url, error);
         return false;
@@ -379,7 +384,6 @@ const form: React.FC<FormProps> = ({
           setFileUrl(npwpUrl);
           setHasNpwp(true);
           updateForm('npwp_document', ' ');
-          updateForm('sppkp_document', ' ');
         }
       });
 
@@ -387,6 +391,7 @@ const form: React.FC<FormProps> = ({
         if (isAccessible) {
           setFileUrlSppkp(sppkpUrl);
           setHasSPPKP(true);
+          updateForm('sppkp_document', ' ');
         }
       });
     }
-- 
cgit v1.2.3

