import { Link } from "react-router-dom"; import axiosInstance from "./api/axiosInstance"; import { useAuth } from "./context/authContext"; const Nav = () => { const { user, setUser, isAuthLoading } = useAuth(); const handleLogout = async () => { try { await axiosInstance.post("/auth/logout"); setUser(undefined); } catch (error) { console.error("Logout failed:", error); } }; return (
Finkwave
{!isAuthLoading && (
{user ? (
{user.username.charAt(0).toUpperCase()}

{user.username}

{user.role}

) : (
Login
)}
)}
); }; export default Nav;