From 1b3d402a142421f5f6a64a693f7c329fc46281e1 Mon Sep 17 00:00:00 2001 From: SeanKim05 Date: Sat, 11 Jan 2025 22:15:26 +0900 Subject: [PATCH 1/4] =?UTF-8?q?Fix:=20API=20=EB=B3=80=EA=B2=BD=EC=97=90=20?= =?UTF-8?q?=EB=94=B0=EB=A5=B8=20=EB=A6=AC=EB=B7=B0=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/app/gatherings/[id]/detail/page.tsx | 2 +- .../comments-section/CommentsSection.tsx | 31 ++++++++----------- front/src/libs/gatherDetail.ts | 24 +++++--------- front/src/types/gatherings.ts | 2 +- 4 files changed, 23 insertions(+), 36 deletions(-) diff --git a/front/src/app/gatherings/[id]/detail/page.tsx b/front/src/app/gatherings/[id]/detail/page.tsx index e204ff7..4b2d91d 100644 --- a/front/src/app/gatherings/[id]/detail/page.tsx +++ b/front/src/app/gatherings/[id]/detail/page.tsx @@ -5,7 +5,7 @@ import { Review } from "@/types/reviews"; export default async function Detail({ params }: { params: { id: number } }) { const { id } = params; - const initialReviews: Review[] = await getUserReviews({ + const initialReviews: { data: Review[] } = await getUserReviews({ pageId: id, offset: 0, limit: 4, diff --git a/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx b/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx index 50d5e62..bbe9c57 100644 --- a/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx +++ b/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx @@ -11,41 +11,36 @@ export default function CommentsSection({ initialReviews, }: { pageId: number; - initialReviews: Review[]; + initialReviews: { data: Review[] }; }) { - const [currentPage, setCurrentPage] = useState(1); - const reviewsPerPage = 4; + const [offset, setOffset] = useState(0); const { data: reviewData = [] } = useGatherReview({ pageId, - offset: 0, - limit: 0, + offset, + limit: 4, }); - const totalReviews = reviewData.length; - const totalPages = Math.ceil(totalReviews / reviewsPerPage); - - const indexOfLastReview = currentPage * reviewsPerPage; - const indexOfFirstReview = indexOfLastReview - reviewsPerPage; - const currentReviews = - currentPage === 1 - ? initialReviews - : reviewData.slice(indexOfFirstReview, indexOfLastReview); + const totalReviews = reviewData?.totalItemCount; + const totalPages = reviewData?.totalPages; + const currentPage = reviewData?.currentPage; const handlePageChange = (page: number) => { - setCurrentPage(page); + setOffset((page - 1) * 4); }; + const reviewInpage = currentPage === 1 ? initialReviews : reviewData; + console.log(reviewInpage); return (

이용자들은 이 프로그램을 이렇게 느꼈어요!

- {currentReviews.length > 0 ? ( + {totalReviews > 0 ? ( <> -
- {currentReviews.map((review: Review) => ( +
+ {reviewInpage.data.map((review: Review) => ( ))}
diff --git a/front/src/libs/gatherDetail.ts b/front/src/libs/gatherDetail.ts index 226e4eb..d40ac12 100644 --- a/front/src/libs/gatherDetail.ts +++ b/front/src/libs/gatherDetail.ts @@ -44,20 +44,12 @@ export const getGatherJoined = async () => { }; export const getUserReviews = async ({ pageId, offset, limit }: UserRiveiw) => { - try { - const limitQuery = () => { - return limit !== 0 ? `&limit=${limit}` : ""; - }; - - const res = await axiosInstance.get( - `/reviews?gatheringId=${pageId}${limitQuery()}&offset=${offset}`, - ); - console.log( - `/reviews?gatheringId=${pageId}${limitQuery()}&offset=${offset}`, - ); - console.log(res?.data); - return res?.data; - } catch (error) { - console.error(error); - } + const limitQuery = () => { + return limit !== 0 ? `&limit=${limit}` : ""; + }; + + const res = await axiosInstance.get( + `/reviews?gatheringId=${pageId}${limitQuery()}&offset=${offset}`, + ); + return res?.data; }; diff --git a/front/src/types/gatherings.ts b/front/src/types/gatherings.ts index f85b66a..e341206 100644 --- a/front/src/types/gatherings.ts +++ b/front/src/types/gatherings.ts @@ -52,5 +52,5 @@ export interface ICreateGathering { export interface UserRiveiw { pageId: number; offset: number; - limit: number; + limit?: number; } From ffe6cb36bc8389fea878c88ffe70f9d5b4ada020 Mon Sep 17 00:00:00 2001 From: SeanKim05 Date: Sun, 12 Jan 2025 13:51:22 +0900 Subject: [PATCH 2/4] =?UTF-8?q?Feat:=20=EC=83=81=EC=84=B8=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EB=A6=AC=EB=B7=B0=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20hydration=20Boundary=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/app/gatherings/[id]/detail/page.tsx | 23 ++++++++++++------- .../comments-section/CommentsSection.tsx | 12 ++-------- front/src/hooks/queries/gatherDetailQuery.ts | 17 +++++++++++++- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/front/src/app/gatherings/[id]/detail/page.tsx b/front/src/app/gatherings/[id]/detail/page.tsx index 4b2d91d..b18e3d5 100644 --- a/front/src/app/gatherings/[id]/detail/page.tsx +++ b/front/src/app/gatherings/[id]/detail/page.tsx @@ -1,21 +1,28 @@ -import { getUserReviews } from "@/libs/gatherDetail"; import CommentsSection from "../../components/detail/comments-section/CommentsSection"; import ClientGather from "./ClientGather"; -import { Review } from "@/types/reviews"; + +import { + HydrationBoundary, + QueryClient, + dehydrate, +} from "@tanstack/react-query"; +import { prefetchGatherReview } from "@/hooks/queries/gatherDetailQuery"; export default async function Detail({ params }: { params: { id: number } }) { + const queryClient = new QueryClient(); const { id } = params; - const initialReviews: { data: Review[] } = await getUserReviews({ - pageId: id, - offset: 0, - limit: 4, - }); + + await prefetchGatherReview(queryClient, { pageId: id, offset: 0, limit: 4 }); + + const dehydratedState = dehydrate(queryClient); return (
- + + +
); diff --git a/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx b/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx index bbe9c57..2c344a1 100644 --- a/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx +++ b/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx @@ -6,13 +6,7 @@ import Pagination from "./Pagination"; import { Review } from "@/types/reviews"; import { useGatherReview } from "@/hooks/queries/gatherDetailQuery"; -export default function CommentsSection({ - pageId, - initialReviews, -}: { - pageId: number; - initialReviews: { data: Review[] }; -}) { +export default function CommentsSection({ pageId }: { pageId: number }) { const [offset, setOffset] = useState(0); const { data: reviewData = [] } = useGatherReview({ @@ -29,8 +23,6 @@ export default function CommentsSection({ setOffset((page - 1) * 4); }; - const reviewInpage = currentPage === 1 ? initialReviews : reviewData; - console.log(reviewInpage); return (

@@ -40,7 +32,7 @@ export default function CommentsSection({ {totalReviews > 0 ? ( <>
- {reviewInpage.data.map((review: Review) => ( + {reviewData.data.map((review: Review) => ( ))}
diff --git a/front/src/hooks/queries/gatherDetailQuery.ts b/front/src/hooks/queries/gatherDetailQuery.ts index a521520..cbe51b0 100644 --- a/front/src/hooks/queries/gatherDetailQuery.ts +++ b/front/src/hooks/queries/gatherDetailQuery.ts @@ -10,7 +10,12 @@ import { import useAuthStore from "@/stores/useAuthStore"; import { useToastStore } from "@/stores/useToastStore"; import { UserRiveiw } from "@/types/gatherings"; -import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; +import { + QueryClient, + useMutation, + useQuery, + useQueryClient, +} from "@tanstack/react-query"; export const useGatherDeatilQuery = (gatherId: number) => { return useQuery({ @@ -88,3 +93,13 @@ export const useGatherReview = ({ pageId, offset, limit }: UserRiveiw) => { queryFn: () => getUserReviews({ pageId, offset, limit }), }); }; + +export const prefetchGatherReview = async ( + queryClient: QueryClient, + { pageId, offset, limit }: UserRiveiw, +) => { + await queryClient.prefetchQuery({ + queryKey: ["gatherReview", pageId, offset, limit], + queryFn: () => getUserReviews({ pageId, offset, limit }), + }); +}; From 2a4f2fb364eec1023e4951ab98b017429b9af180 Mon Sep 17 00:00:00 2001 From: SeanKim05 Date: Sun, 12 Jan 2025 14:30:02 +0900 Subject: [PATCH 3/4] =?UTF-8?q?Fix:=20=EC=9D=BC=EB=B6=80=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=8B=9C=EB=A7=A8=ED=8B=B1=20?= =?UTF-8?q?=ED=83=9C=EA=B7=B8=20=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gatherings/[id]/detail/ClientGather.tsx | 4 +- front/src/app/gatherings/[id]/detail/page.tsx | 12 +++--- .../components/detail/ActionBtnGroup.tsx | 25 ++++++------ .../detail/comments-section/CommentsCard.tsx | 36 +++++++++--------- .../comments-section/CommentsSection.tsx | 38 +++++++++---------- .../gathering-section/GatehringSection.tsx | 2 +- .../gathering-section/GatheringInfo.tsx | 16 ++++---- 7 files changed, 63 insertions(+), 70 deletions(-) diff --git a/front/src/app/gatherings/[id]/detail/ClientGather.tsx b/front/src/app/gatherings/[id]/detail/ClientGather.tsx index 5ecaa0a..f6ccf5d 100644 --- a/front/src/app/gatherings/[id]/detail/ClientGather.tsx +++ b/front/src/app/gatherings/[id]/detail/ClientGather.tsx @@ -18,7 +18,7 @@ export default function ClientGather({ pageId }: { pageId: number }) { const isGatherLoading = isDetailLoading || participantLoading; return ( -
+
-
+ ); } diff --git a/front/src/app/gatherings/[id]/detail/page.tsx b/front/src/app/gatherings/[id]/detail/page.tsx index b18e3d5..9edd052 100644 --- a/front/src/app/gatherings/[id]/detail/page.tsx +++ b/front/src/app/gatherings/[id]/detail/page.tsx @@ -17,13 +17,11 @@ export default async function Detail({ params }: { params: { id: number } }) { const dehydratedState = dehydrate(queryClient); return ( -
-
- - - - -
+
+ + + +
); } diff --git a/front/src/app/gatherings/components/detail/ActionBtnGroup.tsx b/front/src/app/gatherings/components/detail/ActionBtnGroup.tsx index 8994aa8..3de70e9 100644 --- a/front/src/app/gatherings/components/detail/ActionBtnGroup.tsx +++ b/front/src/app/gatherings/components/detail/ActionBtnGroup.tsx @@ -111,27 +111,28 @@ export default function ActionBtnGroup({ } return ( -
-
-

+
+
더 건강한 나와 팀을 위한 프로그램 🏃‍️️ -

-
+ +
{isCreated ? ( "모임을 공유해서 더 많은 사람들이 참여할 수 있도록 독려해봐요" ) : ( -
-
국내 최고 웰니스 전문가와 프로그램을
-
통해 지친 몸과 마음을 회복해요
-
+

+ 국내 최고 웰니스 전문가와 프로그램을 + 통해 지친 몸과 마음을 회복해요 +

)} -
-
+ + +
{isCreated ? (
@@ -167,6 +168,6 @@ export default function ActionBtnGroup({ message="로그인이 필요해요" onConfirm={handleLoginRedirect} /> -
+ ); } diff --git a/front/src/app/gatherings/components/detail/comments-section/CommentsCard.tsx b/front/src/app/gatherings/components/detail/comments-section/CommentsCard.tsx index 3e9c10d..a7576b8 100644 --- a/front/src/app/gatherings/components/detail/comments-section/CommentsCard.tsx +++ b/front/src/app/gatherings/components/detail/comments-section/CommentsCard.tsx @@ -21,36 +21,34 @@ export default function CommentsCard({ }; return ( -
-
+
+
{renderHearts(singleReviewData.score)} -
-
{singleReviewData.comment}
-
-
+ +
+ {singleReviewData.comment} +
+
+ profile img -
+ {singleReviewData.User.name} | - + -
-
- dashed Img -
-
+ + + + ); } diff --git a/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx b/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx index 2c344a1..19b447c 100644 --- a/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx +++ b/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx @@ -14,44 +14,40 @@ export default function CommentsSection({ pageId }: { pageId: number }) { offset, limit: 4, }); - - const totalReviews = reviewData?.totalItemCount; - const totalPages = reviewData?.totalPages; - const currentPage = reviewData?.currentPage; + const { totalItemCount, totalPages, currentPage } = reviewData; const handlePageChange = (page: number) => { setOffset((page - 1) * 4); }; return ( -
+

이용자들은 이 프로그램을 이렇게 느꼈어요!

- {totalReviews > 0 ? ( + {totalItemCount > 0 ? ( <> -
+
{reviewData.data.map((review: Review) => ( ))} -
- - {totalPages > 1 && ( -
- -
- )} +
) : ( -
+

아직 리뷰가 없어요

-
+

+ )} + {totalPages > 1 && ( +
+ +
)} -
+ ); } diff --git a/front/src/app/gatherings/components/detail/gathering-section/GatehringSection.tsx b/front/src/app/gatherings/components/detail/gathering-section/GatehringSection.tsx index f8cace1..72d576b 100644 --- a/front/src/app/gatherings/components/detail/gathering-section/GatehringSection.tsx +++ b/front/src/app/gatherings/components/detail/gathering-section/GatehringSection.tsx @@ -26,7 +26,7 @@ export default function GatheringSection({ } return ( -
+
-
+
+
-
-
+ +

{titleInfo || ""} -

+
{locationInfo || ""}
-
+
- + +
); } From c03daebead80ac60078ebe67f9c1d1c1d733987f Mon Sep 17 00:00:00 2001 From: SeanKim05 Date: Sun, 12 Jan 2025 16:51:04 +0900 Subject: [PATCH 4/4] =?UTF-8?q?Fix:=20=EC=83=81=EC=84=B8=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EB=A0=8C=EB=8D=94=EB=A7=81=20=EB=B0=A9=EC=8B=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gatherings/[id]/detail/ClientGather.tsx | 35 ----- front/src/app/gatherings/[id]/detail/page.tsx | 4 +- .../components/detail/ActionBtnGroup.tsx | 6 +- .../components/detail/GatherInfo.tsx | 21 +++ .../comments-section/CommentsSection.tsx | 1 - .../{GatheringInfo.tsx => DetailInfo.tsx} | 5 +- .../gathering-section/GatehringSection.tsx | 124 +++++++++--------- front/src/hooks/queries/gatherDetailQuery.ts | 10 ++ 8 files changed, 100 insertions(+), 106 deletions(-) delete mode 100644 front/src/app/gatherings/[id]/detail/ClientGather.tsx create mode 100644 front/src/app/gatherings/components/detail/GatherInfo.tsx rename front/src/app/gatherings/components/detail/gathering-section/{GatheringInfo.tsx => DetailInfo.tsx} (93%) diff --git a/front/src/app/gatherings/[id]/detail/ClientGather.tsx b/front/src/app/gatherings/[id]/detail/ClientGather.tsx deleted file mode 100644 index f6ccf5d..0000000 --- a/front/src/app/gatherings/[id]/detail/ClientGather.tsx +++ /dev/null @@ -1,35 +0,0 @@ -"use client"; - -import React from "react"; - -import GatehringSection from "../../components/detail/gathering-section/GatehringSection"; -import ActionBtnGroup from "../../components/detail/ActionBtnGroup"; -import { - useGatherDeatilQuery, - useGatherParticipants, -} from "@/hooks/queries/gatherDetailQuery"; - -export default function ClientGather({ pageId }: { pageId: number }) { - const { data: detailData = [], isLoading: isDetailLoading } = - useGatherDeatilQuery(pageId); - const { data: participantData = [], isLoading: participantLoading } = - useGatherParticipants(pageId, detailData?.participantCount); - - const isGatherLoading = isDetailLoading || participantLoading; - - return ( -
- - -
- ); -} diff --git a/front/src/app/gatherings/[id]/detail/page.tsx b/front/src/app/gatherings/[id]/detail/page.tsx index 9edd052..124c196 100644 --- a/front/src/app/gatherings/[id]/detail/page.tsx +++ b/front/src/app/gatherings/[id]/detail/page.tsx @@ -1,5 +1,5 @@ import CommentsSection from "../../components/detail/comments-section/CommentsSection"; -import ClientGather from "./ClientGather"; +import GatherInfo from "../../components/detail/GatherInfo"; import { HydrationBoundary, @@ -18,7 +18,7 @@ export default async function Detail({ params }: { params: { id: number } }) { return (
- + diff --git a/front/src/app/gatherings/components/detail/ActionBtnGroup.tsx b/front/src/app/gatherings/components/detail/ActionBtnGroup.tsx index 3de70e9..921986f 100644 --- a/front/src/app/gatherings/components/detail/ActionBtnGroup.tsx +++ b/front/src/app/gatherings/components/detail/ActionBtnGroup.tsx @@ -11,17 +11,17 @@ import LoginAlertModal from "@/app/components/LoginAlertModal"; import { useRouter } from "next/navigation"; import useAuthStore from "@/stores/useAuthStore"; import { useToastStore } from "@/stores/useToastStore"; -import { IGatherings } from "@/types/gatherings"; import { isBefore } from "date-fns"; +import { IGatherings } from "@/types/gatherings"; export default function ActionBtnGroup({ + isGatherLoading, pageId, detailData, - isGatherLoading, }: { pageId: number; - detailData: IGatherings; isGatherLoading: boolean; + detailData: IGatherings; }) { const { createdBy, participantCount, capacity, registrationEnd } = detailData; const router = useRouter(); diff --git a/front/src/app/gatherings/components/detail/GatherInfo.tsx b/front/src/app/gatherings/components/detail/GatherInfo.tsx new file mode 100644 index 0000000..d68c118 --- /dev/null +++ b/front/src/app/gatherings/components/detail/GatherInfo.tsx @@ -0,0 +1,21 @@ +import GatehringSection from "./gathering-section/GatehringSection"; +import { + HydrationBoundary, + QueryClient, + dehydrate, +} from "@tanstack/react-query"; +import { prefetchGatherDeatilQuery } from "@/hooks/queries/gatherDetailQuery"; + +export default async function GatherInfo({ pageId }: { pageId: number }) { + const queryClient = new QueryClient(); + await prefetchGatherDeatilQuery(queryClient, pageId); + const dehydratedState = dehydrate(queryClient); + + return ( +
+ + + +
+ ); +} diff --git a/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx b/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx index 19b447c..069bbb7 100644 --- a/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx +++ b/front/src/app/gatherings/components/detail/comments-section/CommentsSection.tsx @@ -19,7 +19,6 @@ export default function CommentsSection({ pageId }: { pageId: number }) { const handlePageChange = (page: number) => { setOffset((page - 1) * 4); }; - return (

diff --git a/front/src/app/gatherings/components/detail/gathering-section/GatheringInfo.tsx b/front/src/app/gatherings/components/detail/gathering-section/DetailInfo.tsx similarity index 93% rename from front/src/app/gatherings/components/detail/gathering-section/GatheringInfo.tsx rename to front/src/app/gatherings/components/detail/gathering-section/DetailInfo.tsx index ffc6a18..0ce0070 100644 --- a/front/src/app/gatherings/components/detail/gathering-section/GatheringInfo.tsx +++ b/front/src/app/gatherings/components/detail/gathering-section/DetailInfo.tsx @@ -1,8 +1,6 @@ import DateTag from "@/app/gatherings/components/DateTag"; import FavoriteButton from "@/app/gatherings/components/FavoriteButton"; -import React from "react"; - interface GatheringInfo { dateInfo: string; titleInfo: string; @@ -10,12 +8,13 @@ interface GatheringInfo { pageId: number; } -export default function GatheringInfo({ +export default function DetailInfo({ dateInfo, titleInfo, locationInfo, pageId, }: GatheringInfo) { + console.log(dateInfo); return (
diff --git a/front/src/app/gatherings/components/detail/gathering-section/GatehringSection.tsx b/front/src/app/gatherings/components/detail/gathering-section/GatehringSection.tsx index 72d576b..2a9897e 100644 --- a/front/src/app/gatherings/components/detail/gathering-section/GatehringSection.tsx +++ b/front/src/app/gatherings/components/detail/gathering-section/GatehringSection.tsx @@ -6,74 +6,74 @@ import { motion } from "framer-motion"; import UserAvatar from "./UserAvatar"; import ProgressBar from "@/app/gatherings/components/ProgressBar"; import DeadLineTag from "@/app/gatherings/components/DeadLineTag"; -import GatheringInfo from "./GatheringInfo"; -import GatheringSecSkeleton from "./GatheringSecSkeleton"; -import { GatheringsParticipants, IGatherings } from "@/types/gatherings"; +import DetailInfo from "./DetailInfo"; +// import GatheringSecSkeleton from "./GatheringSecSkeleton"; +import { + useGatherDeatilQuery, + useGatherParticipants, +} from "@/hooks/queries/gatherDetailQuery"; +import ActionBtnGroup from "../ActionBtnGroup"; -export default function GatheringSection({ - detailData, - participantData, - pageId, - isGatherLoading, -}: { - pageId: number; - detailData: IGatherings; - participantData: GatheringsParticipants[]; - isGatherLoading: boolean; -}) { - if (isGatherLoading) { - return ; - } +export default function GatheringSection({ pageId }: { pageId: number }) { + const { data: detailData = [], isLoading: isDetailLoading } = + useGatherDeatilQuery(pageId); + const { data: participantData = [], isLoading: participantLoading } = + useGatherParticipants(pageId, detailData?.participantCount); + console.log(detailData); return ( -
- - Gather Detail Img - - - - - - -
-
- +
+ + Gather Detail Img - + + +
+ -
-
최소인원 5명
-
최대인원 {detailData?.capacity}명
+ +
+
+ + +
+
최소인원 5명
+
최대인원 {detailData?.capacity}명
+
- -
+
+ + ); } diff --git a/front/src/hooks/queries/gatherDetailQuery.ts b/front/src/hooks/queries/gatherDetailQuery.ts index cbe51b0..54f0c32 100644 --- a/front/src/hooks/queries/gatherDetailQuery.ts +++ b/front/src/hooks/queries/gatherDetailQuery.ts @@ -24,6 +24,16 @@ export const useGatherDeatilQuery = (gatherId: number) => { }); }; +export const prefetchGatherDeatilQuery = async ( + queryClient: QueryClient, + gatherId: number, +) => { + await queryClient.prefetchQuery({ + queryKey: ["gatherDetail", gatherId], + queryFn: () => getGatherDetail(gatherId), + }); +}; + export const useGatherParticipants = (gatherId: number, limit: number) => { return useQuery({ queryKey: ["gatherParticipants", gatherId, limit],