diff --git a/src/components/profile-components/profile-menu/index.tsx b/src/components/profile-components/profile-menu/index.tsx index 765aebd3..b89d6d28 100644 --- a/src/components/profile-components/profile-menu/index.tsx +++ b/src/components/profile-components/profile-menu/index.tsx @@ -5,8 +5,11 @@ import ExitIcon from '@images/profile/exit.svg?react'; import HeartIcon from '@images/profile/heart.svg?react'; import MarkerIcon from '@images/profile/marker.svg?react'; import UserIcon from '@images/profile/user.svg?react'; -// import { useAuth } from '@hooks/use-auth'; +import { useAuth } from '@hooks/use-auth'; import clsx from 'clsx'; +import { usePopup } from '@hooks/use-popup'; +import Popup from '@components/popup'; +import { useState } from 'react'; const menuArray = [ { title: 'Мои заказы', Icon: BagIcon, path: '.' }, @@ -18,11 +21,17 @@ const menuArray = [ export default function ProfileMenu() { const navigate = useNavigate(); - // const { logout } = useAuth(); + const { logout } = useAuth(); + const { handleOpenPopup, handleClosePopup, popupState } = usePopup(); + const [isLoadingExit, setIsLoadingExit] = useState(false); - const onClick = () => { - // logout(); - navigate('/'); + const handleExit = () => { + setIsLoadingExit(true); + logout().then(() => { + handleClosePopup('openPopupLogout'); + setIsLoadingExit(false); + navigate('/'); + }); }; return (