From 3eb78e21b89bd0bdddb803767ea6ec983794994b Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Sat, 28 Sep 2024 10:01:30 +0700 Subject: update temp switch account --- src/lib/auth/components/Menu.jsx | 22 +++++++++++++++++++--- src/pages/my/profile.jsx | 10 +++++----- 2 files changed, 24 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/lib/auth/components/Menu.jsx b/src/lib/auth/components/Menu.jsx index 979de83b..042b1842 100644 --- a/src/lib/auth/components/Menu.jsx +++ b/src/lib/auth/components/Menu.jsx @@ -3,20 +3,36 @@ import { useRouter } from 'next/router'; import ImageNext from 'next/image'; import whatsappUrl from '@/core/utils/whatsappUrl'; import useAuth from '@/core/hooks/useAuth'; -import Divider from '@/core/components/elements/Divider/Divider'; +import switchAccountProgresApi from '@/lib/auth/api/switchAccountProgresApi.js'; +import { useState, useEffect } from 'react'; const Menu = () => { const router = useRouter(); const auth = useAuth(); + // console.log('auth', auth); + const [ubahAkun, setUbahAkun] = useState(); + // const [isAprove, setIsAprove] = useState(); + useEffect(() => { + const loadProgres = async () => { + const progresSwitchAccount = await switchAccountProgresApi(); + console.log('progresSwitchAccount', progresSwitchAccount); + // if (progresSwitchAccount) { + // setIsAprove(progresSwitchAccount.status); + setUbahAkun(progresSwitchAccount.status); + // } + }; + loadProgres(); + }, []); const routeStartWith = (route) => router.pathname.startsWith(route); return (
Akun Saya
- {auth?.company && ( + {auth?.company && !ubahAkun && (
Akun Bisnis
)} - {!auth?.company && ( + {ubahAkun &&
Review
} + {!auth?.company && !ubahAkun && (
Akun Individu
)}
diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx index f6063ff2..ee0cd907 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -9,7 +9,7 @@ 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 StatusSwitchAccount from '@/lib/auth/components/StatusSwitchAccount'; import { Checkbox } from '@chakra-ui/react'; import { useState, useEffect } from 'react'; import switchAccountProgresApi from '@/lib/auth/api/switchAccountProgresApi.js'; @@ -89,12 +89,12 @@ export default function Profile() {
)} - {!auth?.parentId + {/* {!auth?.parentId ? auth?.parentId : auth?.parent_id && isAprove != 'unknown' && ( - )} + )} */} {auth?.parentId && } @@ -126,12 +126,12 @@ export default function Profile() { )} - {!auth?.parentId + {/* {!auth?.parentId ? auth?.parentId : auth?.parent_id && isAprove != 'unknown' && ( - )} + )} */} {auth?.parentId && } -- cgit v1.2.3