summaryrefslogtreecommitdiff
path: root/src/pages
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-09-12 10:11:02 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-09-12 10:11:02 +0700
commitab0782b5cf7b65930b0b40528b9205f3f0dfc3a0 (patch)
tree6f28893f1a0d9be80cae9dc02d6861e174a7ffd7 /src/pages
parent752e55686dfee0d536f9e4e128336e91681ba794 (diff)
<iman> update switch account
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/my/profile.jsx14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx
index c9742a14..4beaae5f 100644
--- a/src/pages/my/profile.jsx
+++ b/src/pages/my/profile.jsx
@@ -9,13 +9,14 @@ import SwitchAccount from '@/lib/auth/components/SwitchAccount';
import IsAuth from '@/lib/auth/components/IsAuth';
import Menu from '@/lib/auth/components/Menu';
import PersonalProfile from '@/lib/auth/components/PersonalProfile';
+import StatusSwitchAccount from '@/lib/auth/components/StatusSwitchAccount';
import { Button, Checkbox, Spinner, Tooltip } from '@chakra-ui/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 [isAprove, setIsAprove] = useState('unknown');
const handleChange = async () => {
setIsChecked(!isChecked);
};
@@ -23,12 +24,13 @@ export default function Profile() {
const loadPromo = async () => {
const progresSwitchAccount = await switchAccountProgresApi();
if (progresSwitchAccount) {
- setIsAprove(true);
+ setIsAprove(progresSwitchAccount.status);
}
console.log('progresSwitchAccount', progresSwitchAccount);
};
loadPromo();
}, []);
+ console.log('isAprove', isAprove);
return (
<IsAuth>
<MobileView>
@@ -46,7 +48,7 @@ export default function Profile() {
<Menu />
</div>
<div className='w-9/12 bg-white border border-gray_r-6 rounded'>
- {!auth?.parentId && !isAprove && (
+ {!auth?.parentId && isAprove == 'unknown' && (
<div className='text-sm p-4 flex items-center'>
<Checkbox
borderColor='gray.600'
@@ -64,6 +66,12 @@ export default function Profile() {
<Divider />
</div>
)}
+ {!auth?.parentId
+ ? auth?.parentId
+ : auth?.parent_id &&
+ isAprove != 'unknown' && (
+ <StatusSwitchAccount status={isAprove} />
+ )}
<PersonalProfile />
<Divider />
{auth?.parentId && <CompanyProfile />}