diff --git a/project/frontend/src/components/channel/ChannelMessageBox.tsx b/project/frontend/src/components/channel/ChannelMessageBox.tsx index 88a94f91..b75c0373 100644 --- a/project/frontend/src/components/channel/ChannelMessageBox.tsx +++ b/project/frontend/src/components/channel/ChannelMessageBox.tsx @@ -1,8 +1,11 @@ -import { unwrap } from '@/api/unwrap'; import { ApiContext } from '@/app/_internal/provider/ApiContext'; -import { useCallback, useContext } from 'react'; -import { useQuery } from 'react-query'; -import { MessageContent, messageType } from '../dm/message/MessageContent'; +import useChannelMessage from '@/hooks/chat/useChannel'; +import { useContext } from 'react'; +import { + MessageContent, + MessageContentInterface, + messageType, +} from '../dm/message/MessageContent'; import { MessageSendBox } from '../dm/message/MessageSendBox'; import { ChannelInfo } from './ChannelInfo'; @@ -11,21 +14,15 @@ export function ChannleMessageBox({ }: Readonly<{ channelId: string }>) { const { api } = useContext(ApiContext); - const { isLoading, isError, data } = useQuery( - 'channelInfo', - useCallback( - async () => unwrap(await api.channelControllerFindChannelInfo(channelId)), - [api, channelId], - ), - ); + const { channelInfo, isLoading, channelMessage } = + useChannelMessage(channelId); if (isLoading) return
알 수 없는 에러
; const localMe = localStorage.getItem('me'); const me = localMe ? JSON.parse(localMe) : null; - const myAuthority: any = data.members.filter((mem: any) => { + const myAuthority: any = channelInfo?.members.filter((mem: any) => { return mem.memberId === me?.id; }); if (isLoading) return알 수 없는 에러
; + if (isLoading || !dmInfo) return{message}
diff --git a/project/frontend/src/components/dm/message/OtherChat.tsx b/project/frontend/src/components/dm/message/OtherChat.tsx index 5784d144..1d99c8a4 100644 --- a/project/frontend/src/components/dm/message/OtherChat.tsx +++ b/project/frontend/src/components/dm/message/OtherChat.tsx @@ -55,10 +55,10 @@ export function OtherChat({ setGameMode={toggleGameMode} /> -