Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/app/message/chat/[roomId]/ChatRoomPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const ChatRoomPage = ({ accessToken, roomId, userId }: IProps) => {
run(<Toast type='info'>채팅방에서 추방당했어요.</Toast>);
return;
}
console.log('새 메시지:', message);
setChatMessages((prev) => [...prev, message]);
},
});
Expand Down
2 changes: 0 additions & 2 deletions src/components/pages/chat/chat-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ export const ChatList = ({ userId, accessToken }: IProps) => {
};
const { data: chatList } = useGetChatList({ userId });

console.log(chatList);

// 채팅방 ID 목록 추출
const chatRoomIds = useMemo(() => {
return chatList?.chatRooms?.map((chat) => chat.chatRoomId) || [];
Expand Down
1 change: 0 additions & 1 deletion src/components/pages/chat/chat-user-list/UserOutModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const UserOutModal = ({ nickName, roomId, userId }: IProps) => {
const handleOut = async () => {
try {
await mutateAsync({ targetUserId: userId });
console.log(`${nickName} 내보내기 완료`);
close();
} catch (e) {
console.error(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const FollowingContent = ({ initialUserId, accessToken }: FollowingConten
</>
) : (
!error && (
<div className='flex flex-1 items-center justify-center'>
<div className='relative min-h-[500px] flex-1 items-center justify-center'>
<FollowingNone />
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const FollowingModal = ({ userId }: { userId: number }) => {
run(<Toast type='success'>{nickname}님을 팔로우 했어요!</Toast>);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
console.log(error);
setErrorMessage(error.detail.slice(4));
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export const FollowingSearch = ({ userId }: { userId: number }) => {
return (
<div
className='bg-mono-white mb-2 flex items-center gap-5 px-5 py-4 transition-all hover:cursor-pointer hover:opacity-80'
onClick={() => open(<FollowingModal userId={userId} />)}
onClick={() => {
open(<FollowingModal userId={userId} />);
console.log('hi');
}}
>
<div className='rounded-full border-2 border-dashed border-gray-400 bg-gray-100 p-2'>
<Icon id='plus' className='size-6 text-gray-700' />
Expand Down
10 changes: 6 additions & 4 deletions src/hooks/use-chat/use-chat-list-socket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ export const useChatListSocket = ({
});

client.onConnect = () => {
console.log('✅ Chat list socket connected');

if (process.env.NODE_ENV === 'development') {
console.log('✅ Chat list socket connected');
}
// 모든 채팅방 구독
chatRoomIds.forEach((roomId) => {
const subscription = client.subscribe(`/sub/chat/room/${roomId}`, (message: IMessage) => {
const payload = JSON.parse(message.body);
console.log('🔔 새 메시지 수신:', payload);

if (process.env.NODE_ENV === 'development') {
console.log('🔔 새 메시지 수신:', payload);
}
// 채팅 목록 갱신
queryClient.invalidateQueries({
queryKey: ['chatList', userId],
Expand Down
19 changes: 14 additions & 5 deletions src/hooks/use-chat/use-chat-socket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,21 @@ export const useChatSocket = ({
connectHeaders: {
Authorization: `Bearer ${accessToken}`,
},
debug: (str) => console.log(str),
debug: (str) => {
if (process.env.NODE_ENV === 'development') {
console.log(str);
}
},
reconnectDelay: 6000,
heartbeatIncoming: 4000,
heartbeatOutgoing: 4000,
});

client.onConnect = () => {
setIsConnected(true);
console.log('WebSocket connected');

if (process.env.NODE_ENV === 'development') {
console.log('WebSocket connected');
}
// 채팅방 구독
client.subscribe(`/sub/chat/room/${roomId}`, (message: IMessage) => {
try {
Expand All @@ -85,7 +90,9 @@ export const useChatSocket = ({

client.onDisconnect = () => {
setIsConnected(false);
console.log('WebSocket disconnected');
if (process.env.NODE_ENV === 'development') {
console.log('WebSocket disconnected');
}
};

client.onStompError = (frame) => {
Expand Down Expand Up @@ -117,7 +124,9 @@ export const useChatSocket = ({
const sendMessage = useCallback(
(content: string) => {
if (!clientRef.current?.connected) {
console.log('WebSocket is not connected');
if (process.env.NODE_ENV === 'development') {
console.log('WebSocket is not connected');
}
return false;
}

Expand Down
2 changes: 0 additions & 2 deletions src/hooks/use-follower/use-follower-add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ export const useAddFollowers = (
...options,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['followers', userId] });
console.log('팔로워 추가 성공');
},
onError: (error) => {
console.log('팔로워 추가 실패');
throw error;
},
});
Expand Down