diff --git a/src/components/epigram/Comment/CommentList.tsx b/src/components/epigram/Comment/CommentList.tsx index e2a4fff4..5a605fe9 100644 --- a/src/components/epigram/Comment/CommentList.tsx +++ b/src/components/epigram/Comment/CommentList.tsx @@ -1,4 +1,4 @@ -import { useEpigramCommentsQuery } from '@/hooks/useEpigramQueryHook'; +import useEpigramCommentsQuery from '@/hooks/useEpigramCommentHook'; import { EpigramCommentProps } from '@/types/epigram.types'; import CommentItem from './CommentItem'; import NoComment from './NoComment'; diff --git a/src/hooks/useEpigramComment.ts b/src/hooks/useEpigramComment.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/src/hooks/useEpigramCommentHook.ts b/src/hooks/useEpigramCommentHook.ts new file mode 100644 index 00000000..126695f5 --- /dev/null +++ b/src/hooks/useEpigramCommentHook.ts @@ -0,0 +1,7 @@ +import queries from '@/apis/queries'; +import { CommentRequestType } from '@/schema/comment'; +import { useQuery } from '@tanstack/react-query'; + +const useEpigramCommentsQuery = (request: CommentRequestType) => useQuery(queries.epigramComment.getComments(request)); + +export default useEpigramCommentsQuery; diff --git a/src/hooks/useEpigramQueryHook.ts b/src/hooks/useEpigramQueryHook.ts index 8c199a00..5bd0067c 100644 --- a/src/hooks/useEpigramQueryHook.ts +++ b/src/hooks/useEpigramQueryHook.ts @@ -1,12 +1,11 @@ import { useQuery } from '@tanstack/react-query'; import queries from '@/apis/queries'; import { GetEpigramRequestType } from '@/schema/epigram'; -import { CommentRequestType } from '@/schema/comment'; -export const useEpigramQuery = (request: GetEpigramRequestType | undefined, enabled = true) => +const useEpigramQuery = (request: GetEpigramRequestType | undefined, enabled = true) => useQuery({ ...queries.epigram.getEpigram(request ?? { id: undefined }), enabled: enabled && request?.id !== undefined, }); -export const useEpigramCommentsQuery = (request: CommentRequestType) => useQuery(queries.epigramComment.getComments(request)); +export default useEpigramQuery; diff --git a/src/pages/epigram/[id].tsx b/src/pages/epigram/[id].tsx index 61034cbe..4fa9d1fc 100644 --- a/src/pages/epigram/[id].tsx +++ b/src/pages/epigram/[id].tsx @@ -1,5 +1,5 @@ import { GetEpigramRequestSchema } from '@/schema/epigram'; -import { useEpigramQuery } from '@/hooks/useEpigramQueryHook'; +import useEpigramQuery from '@/hooks/useEpigramQueryHook'; import EpigramComment from '@/pageLayout/Epigram/EpigramComment'; import EpigramFigure from '@/pageLayout/Epigram/EpigramFigure'; import Image from 'next/image';