import { useReactiveVar } from '@apollo/client'; import { useNavigate, useLocation } from 'react-router'; import { roleVar, tokenVar, userVar } from '../../graphql/state'; import { Wrapper } from './styles'; import { Avatar, Link, Menu, Text } from '..'; import { Settings, Logout, Logo } from '../../assets'; const Navbar = () => { const user = useReactiveVar(userVar); const role = useReactiveVar(roleVar); const navigate = useNavigate(); const location = useLocation(); return (
{user?.firstName} {user?.lastName}
, label: 'Settings', action: () => navigate('/settings'), }, { icon: , label: 'Logout', action: () => { tokenVar(undefined); localStorage.removeItem('token'); navigate('/login'); }, avoid: true, }, ]} /> ); }; export default Navbar;