mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-06 15:18:48 +00:00
make logout button only be there when logged in
This commit is contained in:
parent
9b79f24dc7
commit
6c8ee2e285
1 changed files with 4 additions and 4 deletions
|
@ -12,11 +12,10 @@ import { useAuth } from "../api/Auth";
|
|||
|
||||
function Header() {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const iconRef = useRef<HTMLImageElement>(null);
|
||||
const toggleMenu = () => {
|
||||
setIsOpen(!isOpen);
|
||||
};
|
||||
const { logout } = useAuth();
|
||||
const { logout, user } = useAuth();
|
||||
const iconList = [DynamicFeedIcon, AddAPhotoIcon, PersonIcon, InfoIcon, LogoutIcon];
|
||||
const routerLinksList = ["/","/createpost","/profile","/about","/"]
|
||||
|
||||
|
@ -35,14 +34,15 @@ function Header() {
|
|||
</ListItemButton>
|
||||
</ListItem>
|
||||
))}
|
||||
<ListItem className="drawer-list-item-button" key={"Log Out"} disablePadding>
|
||||
{user && <ListItem className="drawer-list-item-button" key={"Log Out"} disablePadding>
|
||||
<ListItemButton className="drawer-list-item-button" onClick={logout}>
|
||||
<ListItemIcon className="drawer-list-item">
|
||||
{React.createElement(iconList[4])}
|
||||
</ListItemIcon>
|
||||
<ListItemText className="drawer-list-item" primary={"Log Out"}/>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</ListItem> }
|
||||
|
||||
</List>
|
||||
</Box>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue