From 212c0ceba1d7d876b7ab66ec6a1cfa622ac4c95c Mon Sep 17 00:00:00 2001 From: faisalEsMagico Date: Thu, 14 Dec 2023 17:11:48 +0530 Subject: [PATCH] feat(build): done changes for build --- src/app/context/AuthContext.tsx | 20 +++++++++----------- src/app/propTypes/index.tsx | 2 +- src/components/questionBank/SavedLevels.tsx | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/app/context/AuthContext.tsx b/src/app/context/AuthContext.tsx index c9f7905..fa69c92 100644 --- a/src/app/context/AuthContext.tsx +++ b/src/app/context/AuthContext.tsx @@ -19,24 +19,22 @@ const AuthProvider = createContext({ }); const AuthContextContext = ({ children }: { children: React.ReactElement }) => { - const data = localStorage.getItem('adminData') || ''; - let parseData = null; - if (data !== '') { - parseData = JSON.parse(data); - } - // const parseData=JSON.parse(data) - const [adminData, setAdminData] = useState( - parseData ?? null - ); + const [adminData, setAdminData] = useState(null); const router = useRouter(); useEffect(() => { - if (!adminData?.admin) { + const data = localStorage.getItem('adminData') || ''; + let parseData = null; + if (data !== '') { + parseData = JSON.parse(data); + } + if (!parseData?.admin) { router.push('/login'); } else { router.push('/3cp/marketplace'); + setAdminData(parseData); } - }, [adminData?.admin, router]); + }, [router]); return ( null} width='704px' - placeholder={competencyLevelName} + placeholder={competencyLevelName?.toString()} paddingY='2px' isDisabled={true} />