From 61d4aa6469b6a1796fba3bbe80dda22224beb195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=84=EC=9A=B0=EC=B0=AC?= Date: Sat, 23 Dec 2023 16:46:52 +0900 Subject: [PATCH] =?UTF-8?q?QueryKey=20=EB=B6=88=EC=9D=BC=EC=B9=98=EB=A1=9C?= =?UTF-8?q?=20=EC=9D=B8=ED=95=B4=20=EB=B0=9C=EC=83=9D=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0=20(#767)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/hooks/api/useCommunityTripQuery.ts | 4 +++- frontend/src/hooks/api/useExpenseQuery.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/hooks/api/useCommunityTripQuery.ts b/frontend/src/hooks/api/useCommunityTripQuery.ts index 3ff1ed231..afb97eced 100644 --- a/frontend/src/hooks/api/useCommunityTripQuery.ts +++ b/frontend/src/hooks/api/useCommunityTripQuery.ts @@ -1,3 +1,5 @@ +import { TRIP_TYPE } from '@/constants/trip'; + import { useSuspenseQuery } from '@tanstack/react-query'; import { useRecoilValue } from 'recoil'; @@ -14,7 +16,7 @@ export const useCommunityTripQuery = (tripId: string) => { const isLoggedIn = useRecoilValue(isLoggedInState); const { data: communityTripData } = useSuspenseQuery({ - queryKey: ['published', tripId], + queryKey: [TRIP_TYPE.PUBLISHED, tripId], queryFn: () => getCommunityTrip(tripId, isLoggedIn), }); diff --git a/frontend/src/hooks/api/useExpenseQuery.ts b/frontend/src/hooks/api/useExpenseQuery.ts index 838efd0fa..9e57f7fa7 100644 --- a/frontend/src/hooks/api/useExpenseQuery.ts +++ b/frontend/src/hooks/api/useExpenseQuery.ts @@ -27,7 +27,7 @@ export const useExpenseQuery = (tripId: string, tripType: TripTypeData) => { } const { data: expenseData } = useSuspenseQuery({ - queryKey: ['expense', tripType, tripId], + queryKey: [`${tripType}expense`, tripId], queryFn: match(tripType) .with(TRIP_TYPE.PUBLISHED, () => () => getCommunityTripExpense(tripId)) .with(TRIP_TYPE.SHARED, () => () => getSharedExpense(tripId))