From 8636defd70c13fb5994851d3b2c532cdc69b0738 Mon Sep 17 00:00:00 2001 From: hwanheejung Date: Tue, 27 Aug 2024 18:25:15 +0900 Subject: [PATCH] =?UTF-8?q?#164=20fix:=20=EB=B0=A9=20=EC=82=AD=EC=A0=9C=20?= =?UTF-8?q?=EC=8B=9C=20dm=20redirect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/hooks/handlers/useHandleRoom.ts | 3 ++- src/pages/FriendPage.tsx | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/hooks/handlers/useHandleRoom.ts b/src/lib/hooks/handlers/useHandleRoom.ts index 31b83e1..e06788b 100644 --- a/src/lib/hooks/handlers/useHandleRoom.ts +++ b/src/lib/hooks/handlers/useHandleRoom.ts @@ -64,7 +64,7 @@ const useHandleRoom = () => { status: 'success', }); queryClient.invalidateQueries({ queryKey: QUERY_KEYS.ROOMS }); - // navigate(`/chat/channels/${}/${}`) + navigate(`/chat/main`); }, onError: (error) => { console.error('Error deleting room:', error); @@ -85,6 +85,7 @@ const useHandleRoom = () => { status: 'success', }); queryClient.invalidateQueries({ queryKey: QUERY_KEYS.ROOMS }); + navigate(`/chat/main`); }, onError: (error) => { console.error('Error leaving room:', error); diff --git a/src/pages/FriendPage.tsx b/src/pages/FriendPage.tsx index 798e117..7a810e1 100644 --- a/src/pages/FriendPage.tsx +++ b/src/pages/FriendPage.tsx @@ -3,6 +3,7 @@ import useDmStore from '@/lib/stores/useDmStore'; import { Box } from '@chakra-ui/react'; import { useEffect, useState } from 'react'; import { useParams } from 'react-router-dom'; +import useRoomStore from '@/lib/stores/useRoomStore'; import FriendList from '../components/friend/FriendList'; import FriendRequest from '../components/friend/FriendRequest'; import FriendTopMenu from '../components/friend/FriendTopMenu'; @@ -17,6 +18,11 @@ const FriendPage = ({ const roomIdParam = param.id ? parseInt(param.id, 10) : 0; const { setCurrentDmId, dmRooms, setCurrentDmRoom } = useDmStore(); + const { setCurrentChannelPath } = useRoomStore(); + + useEffect(() => { + setCurrentChannelPath({ roomId: 0, categoryId: 0, channelId: 0 }); + }, []); useEffect(() => { setCurrentDmId(roomIdParam);