added logout button
This commit is contained in:
parent
5603f86b87
commit
a317cd8bbc
3 changed files with 28 additions and 10 deletions
|
|
@ -2,7 +2,7 @@ import { Avatar, Box, Button, IconButton, ListItemIcon, ListItemText, Menu, Menu
|
|||
import { useGlobalState } from "../providers/StateContainer";
|
||||
import { getSecondaryColour, getSignatureAccentColour } from "../services/whiteLabel";
|
||||
import { makeStyles } from "@mui/styles";
|
||||
import { LockOpen, Person, Lock, Settings, SupervisedUserCircle as TeamIcon } from "@mui/icons-material";
|
||||
import { LockOpen, Person, Lock, Settings, SupervisedUserCircle as TeamIcon, ExitToApp } from "@mui/icons-material";
|
||||
import { useState } from "react";
|
||||
import UserTeamName from "./UserTeamName";
|
||||
import React from "react";
|
||||
|
|
@ -11,6 +11,7 @@ import { useAuth0 } from "@auth0/auth0-react";
|
|||
import UserSettings from "./UserSettings";
|
||||
import UserAvatar from "./UserAvatar";
|
||||
import { purple } from "@mui/material/colors";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
userAvatar: {
|
||||
|
|
@ -89,6 +90,8 @@ export default function UserMenu(props: Props) {
|
|||
// const allowedToCopyToken = user.allowedTo("copy-token");
|
||||
const hasTeams = user.hasFeature ? user.hasFeature("teams") : false;
|
||||
|
||||
const navigate = useNavigate()
|
||||
|
||||
const lockHover = () => {
|
||||
setLockIsHovered(true);
|
||||
};
|
||||
|
|
@ -121,6 +124,11 @@ export default function UserMenu(props: Props) {
|
|||
setUserSettingsIsOpen(false)
|
||||
}
|
||||
|
||||
const handleLogout = () => {
|
||||
closeUserMenu();
|
||||
navigate("/logout");
|
||||
};
|
||||
|
||||
const unauthenticatedUserMenu = () => {
|
||||
return (
|
||||
<React.Fragment>
|
||||
|
|
@ -203,6 +211,12 @@ export default function UserMenu(props: Props) {
|
|||
</ListItemIcon>
|
||||
<ListItemText primary="User Settings" />
|
||||
</MenuItem>
|
||||
<MenuItem onClick={handleLogout} aria-label="Sign Out" dense>
|
||||
<ListItemIcon>
|
||||
<ExitToApp className={classes.red} />
|
||||
</ListItemIcon>
|
||||
<ListItemText primary="Sign Out" />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<UserSettings isOpen={userSettingsIsOpen} closeDialogCallback={closeUserSettingsDialog} />
|
||||
</>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue