Skip to content

Commit

Permalink
Fixing Changes According to Requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidSumra committed Feb 4, 2024
1 parent 80f5e55 commit cb73db0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions client/src/components/Layout/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ const Header = () => {
const { isOpen, onOpen, onClose } = useDisclosure();
const navigate = useNavigate();
const isAuthenticated = localStorage.getItem('isAuth'); // Change this based on user authentication status
const user = {
role: 'admin', // Change this based on the user's role
};
const userData = JSON.parse(localStorage.getItem('userData'))?.User;

const logout = () => {
localStorage.removeItem('isAuth');
Expand Down Expand Up @@ -89,7 +87,7 @@ const Header = () => {
title="Request A Course"
closingHandler={onClose}
/>
<LinkButton url="/notes" title="Notes" closingHandler={onClose} />
<LinkButton url="/notes" title="Notes" closingHandler={onClose} />

<LinkButton
url="/contact"
Expand Down Expand Up @@ -117,7 +115,7 @@ const Header = () => {
<RiLogoutBoxLine /> Logout
</Button>
</HStack>
{user && user.role === 'admin' && (
{userData && userData?.role === 'admin' && (
<Link onClick={onClose} to="/admin/dashboard">
<Button>
<RiDashboardFill /> Dashboard
Expand Down

0 comments on commit cb73db0

Please sign in to comment.