fix: unlog redirect on login
This commit is contained in:
@@ -97,22 +97,25 @@ export function Sidebar({ isOpen, onClose }: SidebarProps) {
|
|||||||
await Promise.all([fetchLibraries(), fetchFavorites()]);
|
await Promise.all([fetchLibraries(), fetchFavorites()]);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleLogout = () => {
|
const handleLogout = async () => {
|
||||||
authService.logout();
|
await authService.logout();
|
||||||
setLibraries([]);
|
setLibraries([]);
|
||||||
setFavorites([]);
|
setFavorites([]);
|
||||||
onClose();
|
onClose();
|
||||||
router.push("/login");
|
router.push("/login");
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleLinkClick = useCallback((path: string) => {
|
const handleLinkClick = useCallback(
|
||||||
if (pathname === path) {
|
(path: string) => {
|
||||||
|
if (pathname === path) {
|
||||||
|
onClose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
router.push(path);
|
||||||
onClose();
|
onClose();
|
||||||
return;
|
},
|
||||||
}
|
[pathname, router, onClose]
|
||||||
router.push(path);
|
);
|
||||||
onClose();
|
|
||||||
}, [pathname, router, onClose]);
|
|
||||||
|
|
||||||
const navigation = [
|
const navigation = [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user