Skip to content

Commit

Permalink
fix modals open close in profile page
Browse files Browse the repository at this point in the history
* test

* fix bug with modal double click to close in profile page

---------

Co-authored-by: Daniil <daniilminin1990@yandex.ru>
  • Loading branch information
momecaptr and daniilminin1990 authored Dec 4, 2024
1 parent 1d250ab commit 491fed2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pagesComponents/profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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);

Expand Down

0 comments on commit 491fed2

Please sign in to comment.