summaryrefslogtreecommitdiff
path: root/src/pages
diff options
context:
space:
mode:
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 />}