Skip to content

Commit

Permalink
refactor: QueryKey 불일치로 인해 발생하는 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
dladncks1217 committed Dec 23, 2023
1 parent e704d57 commit db937f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion frontend/src/hooks/api/useCommunityTripQuery.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { TRIP_TYPE } from '@/constants/trip';

import { useSuspenseQuery } from '@tanstack/react-query';

import { useRecoilValue } from 'recoil';
Expand All @@ -14,7 +16,7 @@ export const useCommunityTripQuery = (tripId: string) => {
const isLoggedIn = useRecoilValue(isLoggedInState);

const { data: communityTripData } = useSuspenseQuery<TripData, AxiosError>({
queryKey: ['published', tripId],
queryKey: [TRIP_TYPE.PUBLISHED, tripId],
queryFn: () => getCommunityTrip(tripId, isLoggedIn),
});

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/hooks/api/useExpenseQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const useExpenseQuery = (tripId: string, tripType: TripTypeData) => {
}

const { data: expenseData } = useSuspenseQuery<ExpenseData, AxiosError>({
queryKey: ['expense', tripType, tripId],
queryKey: [`${tripType}expense`, tripId],
queryFn: match(tripType)
.with(TRIP_TYPE.PUBLISHED, () => () => getCommunityTripExpense(tripId))
.with(TRIP_TYPE.SHARED, () => () => getSharedExpense(tripId))
Expand Down

0 comments on commit db937f4

Please sign in to comment.