fix: unlog redirect on login

This commit is contained in:
Julien Froidefond
2025-02-19 16:36:17 +01:00
parent aed35ce2b9
commit 04e2917f95

View File

@@ -97,22 +97,25 @@ export function Sidebar({ isOpen, onClose }: SidebarProps) {
await Promise.all([fetchLibraries(), fetchFavorites()]);
};
const handleLogout = () => {
authService.logout();
const handleLogout = async () => {
await authService.logout();
setLibraries([]);
setFavorites([]);
onClose();
router.push("/login");
};
const handleLinkClick = useCallback((path: string) => {
const handleLinkClick = useCallback(
(path: string) => {
if (pathname === path) {
onClose();
return;
}
router.push(path);
onClose();
}, [pathname, router, onClose]);
},
[pathname, router, onClose]
);
const navigation = [
{