From bdc3582e7541166010e2f91bd88a3e2c11a80296 Mon Sep 17 00:00:00 2001 From: yiseungyun Date: Thu, 28 Nov 2024 23:55:39 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=B9=8C=EB=93=9C=20=EC=98=A4=EB=A5=98?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 리액트 쿼리 훅에서 반환하지 않는 값 제거 - 로직 바뀐 테스트 코드 주석 처리 - 이전 모달 로직 사용되는 곳 수정 --- .../questions/detail/QuestionList.tsx/index.tsx | 5 ++--- .../questions/detail/QuestionTitle.tsx/index.tsx | 5 ++--- .../src/components/session/Sidebar/SessionSidebar.tsx | 9 +++++---- frontend/src/hooks/__test__/useSession.test.ts | 4 ++-- frontend/src/pages/QuestionDetailPage.tsx | 5 ++--- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/frontend/src/components/questions/detail/QuestionList.tsx/index.tsx b/frontend/src/components/questions/detail/QuestionList.tsx/index.tsx index d5b16afa..5eafc6b7 100644 --- a/frontend/src/components/questions/detail/QuestionList.tsx/index.tsx +++ b/frontend/src/components/questions/detail/QuestionList.tsx/index.tsx @@ -5,12 +5,11 @@ const QuestionList = ({ questionId }: { questionId: string }) => { const { data: question, isLoading, - isError, error, - } = useGetQuestionContent(questionId); + } = useGetQuestionContent(Number(questionId)); if (isLoading) return
로딩 중
; - if (isError) return
에러가 발생했습니다: {error.message}
; + if (error) return
에러가 발생
; if (!question) return null; return ( diff --git a/frontend/src/components/questions/detail/QuestionTitle.tsx/index.tsx b/frontend/src/components/questions/detail/QuestionTitle.tsx/index.tsx index 11d8b9ec..57cde8a3 100644 --- a/frontend/src/components/questions/detail/QuestionTitle.tsx/index.tsx +++ b/frontend/src/components/questions/detail/QuestionTitle.tsx/index.tsx @@ -7,12 +7,11 @@ const QuestionTitle = ({ questionId }: { questionId: string }) => { const { data: question, isLoading, - isError, error, - } = useGetQuestionContent(questionId); + } = useGetQuestionContent(Number(questionId)); if (isLoading) return
로딩 중
; - if (isError) return
에러가 발생했습니다: {error.message}
; + if (error) return
에러 발생
; if (!question) return null; return ( diff --git a/frontend/src/components/session/Sidebar/SessionSidebar.tsx b/frontend/src/components/session/Sidebar/SessionSidebar.tsx index 3b9e1606..03376a84 100644 --- a/frontend/src/components/session/Sidebar/SessionSidebar.tsx +++ b/frontend/src/components/session/Sidebar/SessionSidebar.tsx @@ -1,6 +1,5 @@ import { FaClipboardList, FaFolder } from "react-icons/fa"; import { FaUserGroup } from "react-icons/fa6"; -import useModalStore from "@stores/useModalStore.ts"; import Modal from "../../common/Modal"; import { useNavigate } from "react-router-dom"; import { Socket } from "socket.io-client"; @@ -8,6 +7,7 @@ import useToast from "@hooks/useToast.ts"; import { TbCrown } from "react-icons/tb"; import { SESSION_EMIT_EVENT } from "@/constants/WebSocket/SessionEvent.ts"; import { Question } from "@hooks/type/session"; +import useModal from "@/hooks/useModal"; interface ParticipantsData { nickname: string; @@ -31,9 +31,9 @@ const SessionSidebar = ({ roomId, isHost, }: Props) => { - const { openModal } = useModalStore(); const navigate = useNavigate(); const toast = useToast(); + const modal = useModal(); const existHandler = () => { socket?.emit(SESSION_EMIT_EVENT.LEAVE, { roomId }); @@ -64,7 +64,7 @@ const SessionSidebar = ({ leftButton: "취소하기", rightButton: "종료하기", type: "red", - onLeftClick: () => {}, + onLeftClick: () => { }, onRightClick: existHandler, }; @@ -141,7 +141,7 @@ const SessionSidebar = ({