From ed679c9b8ea85e8f181cf67465effc4b5ff1a7bc Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 1 Oct 2024 09:42:51 +0700 Subject: 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') 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 = ({ 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 = ({ }; 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 = ({ setFileUrl(npwpUrl); setHasNpwp(true); updateForm('npwp_document', ' '); - updateForm('sppkp_document', ' '); } }); @@ -387,6 +391,7 @@ const form: React.FC = ({ if (isAccessible) { setFileUrlSppkp(sppkpUrl); setHasSPPKP(true); + updateForm('sppkp_document', ' '); } }); } -- cgit v1.2.3