import React from 'react'; import { useSelector, useDispatch } from 'react-redux' import AppBar from '@mui/material/AppBar'; import Avatar from '@mui/material/Avatar'; import Box from '@mui/material/Box'; import Container from '@mui/material/Container'; import Menu from '@mui/material/Menu'; import MenuItem from '@mui/material/MenuItem'; import IconButton from '@mui/material/IconButton'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import logo from './assets/logo.png'; import styles from './AppBar.module.css'; import { Stack, CssBaseline } from '@mui/material'; import { useCookies } from 'react-cookie'; import { useNavigate } from "react-router-dom"; export default function () { const avatarUrl = useSelector(state => state.user.avatarUrl); const nickName = useSelector(state => state.user.nickName); const [cookies, setCookie, removeCookie] = useCookies(['accessToken']); const navigate = useNavigate(); const [anchorElUser, setAnchorElUser] = React.useState(null); const handleOpenUserMenu = (event) => { setAnchorElUser(event.currentTarget); }; const handleCloseUserMenu = () => { setAnchorElUser(null); }; const onLogout = () => { removeCookie("accessToken"); handleCloseUserMenu(); navigate("/login"); } return theme.zIndex.drawer + 1 }} position="sticky" color='black'> 纽曼AI语记 {nickName} 退出 }