From 752e55686dfee0d536f9e4e128336e91681ba794 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 11 Sep 2024 17:07:49 +0700
Subject: <iman> update switch account

---
 src/pages/my/profile.jsx | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

(limited to 'src/pages/my/profile.jsx')

diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx
index ca6f4700..c9742a14 100644
--- a/src/pages/my/profile.jsx
+++ b/src/pages/my/profile.jsx
@@ -10,14 +10,25 @@ import IsAuth from '@/lib/auth/components/IsAuth';
 import Menu from '@/lib/auth/components/Menu';
 import PersonalProfile from '@/lib/auth/components/PersonalProfile';
 import { Button, Checkbox, Spinner, Tooltip } from '@chakra-ui/react';
-import { useState } from 'react';
-
+import { useState, useEffect } from 'react';
+import switchAccountProgresApi from '@/lib/auth/api/switchAccountProgresApi.js';
 export default function Profile() {
   const auth = useAuth();
   const [isChecked, setIsChecked] = useState(false);
+  const [isAprove, setIsAprove] = useState(false);
   const handleChange = async () => {
     setIsChecked(!isChecked);
   };
+  useEffect(() => {
+    const loadPromo = async () => {
+      const progresSwitchAccount = await switchAccountProgresApi();
+      if (progresSwitchAccount) {
+        setIsAprove(true);
+      }
+      console.log('progresSwitchAccount', progresSwitchAccount);
+    };
+    loadPromo();
+  }, []);
   return (
     <IsAuth>
       <MobileView>
@@ -35,7 +46,7 @@ export default function Profile() {
               <Menu />
             </div>
             <div className='w-9/12 bg-white border border-gray_r-6 rounded'>
-              {!auth?.parentId && (
+              {!auth?.parentId && !isAprove && (
                 <div className='text-sm p-4 flex items-center'>
                   <Checkbox
                     borderColor='gray.600'
-- 
cgit v1.2.3

