From ab0782b5cf7b65930b0b40528b9205f3f0dfc3a0 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 12 Sep 2024 10:11:02 +0700 Subject: update switch account --- src/pages/my/profile.jsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/pages') 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 ( @@ -46,7 +48,7 @@ export default function Profile() {
- {!auth?.parentId && !isAprove && ( + {!auth?.parentId && isAprove == 'unknown' && (
)} + {!auth?.parentId + ? auth?.parentId + : auth?.parent_id && + isAprove != 'unknown' && ( + + )} {auth?.parentId && } -- cgit v1.2.3