Skip to content

Commit

Permalink
#164 fix: 방 삭제 시 dm redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
hwanheejung committed Aug 27, 2024
1 parent 774d089 commit 8636def
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/hooks/handlers/useHandleRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions src/pages/FriendPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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);
Expand Down

0 comments on commit 8636def

Please sign in to comment.