From 491fed24e1fe14e5d0791e2de3600e1fc1168506 Mon Sep 17 00:00:00 2001 From: momecaptr Date: Thu, 5 Dec 2024 00:05:46 +0300 Subject: [PATCH] fix modals open close in profile page * test * fix bug with modal double click to close in profile page --------- Co-authored-by: Daniil --- src/pagesComponents/profile/Profile.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pagesComponents/profile/Profile.tsx b/src/pagesComponents/profile/Profile.tsx index 5270958..4963da0 100644 --- a/src/pagesComponents/profile/Profile.tsx +++ b/src/pagesComponents/profile/Profile.tsx @@ -29,7 +29,7 @@ export const Profile = ({ postsUser, user }: Props) => { const router = useRouter(); const { isOpen, setOpen } = useModal(ModalKey.ViewPhoto); - const postId = Number(router.query.id); + const postId = Number(router.query.postId); const { query, ...path } = router; useEffect(() => { @@ -46,6 +46,8 @@ export const Profile = ({ postsUser, user }: Props) => { // Копируем все существующие query-параметры, кроме id const { id, ...newQuery } = router.query; // Исключаем id из query + console.log({ asda: router.query, newQuery }); + // Приводим postId к строке перед добавлением в query newQuery.postId = String(postId);