import { useNavigate } from 'react-router-dom' import { logout } from '../../api/auth' import { useAuthStore } from '../../store/authStore' export default function Navbar() { const navigate = useNavigate() const { user, clearAuth } = useAuthStore() async function handleLogout() { try { await logout() } catch { /* ignore network errors */ } clearAuth() navigate('/login', { replace: true }) } return ( ) }