Skip to content

Commit

Permalink
fix: 전체를 무효화함으로 인해 api요청 여러번 나가는 것 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
simorimi committed Sep 26, 2024
1 parent 746e66b commit 4a12de8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frontend/src/queries/useDeleteTravelPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const useDeleteTravelPlan = () => {
onSuccess: () => {
queryClient
.invalidateQueries({
queryKey: QUERY_KEYS_MAP.travelPlan.all,
queryKey: QUERY_KEYS_MAP.travelPlan.me(),
refetchType: "inactive",
})
.then(() => navigation(ROUTE_PATHS_MAP.my));
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/queries/useDeleteTravelogue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const useDeleteTravelogue = () => {
onSuccess: () => {
queryClient
.invalidateQueries({
queryKey: QUERY_KEYS_MAP.travelogue.all,
queryKey: QUERY_KEYS_MAP.travelogue.me(),
refetchType: "inactive",
})
.then(() => {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/queries/usePostTravelPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { QUERY_KEYS_MAP } from "@constants/queryKey";

export const usePostTravelPlan = () => {
const queryClient = useQueryClient();

const { isPaused, ...rest } = useMutation<
AxiosResponse<TravelPlanResponse & { id: number }, unknown>,
ApiError | AxiosError<ErrorResponse>,
Expand Down Expand Up @@ -42,7 +43,7 @@ export const usePostTravelPlan = () => {
}),
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: QUERY_KEYS_MAP.travelPlan.all,
queryKey: QUERY_KEYS_MAP.travelPlan.me(),
refetchType: "inactive",
});
},
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/queries/usePostTravelogue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { QUERY_KEYS_MAP } from "@constants/queryKey";

export const usePostTravelogue = () => {
const queryClient = useQueryClient();

const { isPaused, ...rest } = useMutation<
AxiosResponse<TravelogueResponse, unknown>,
ApiError | AxiosError<ErrorResponse>,
Expand All @@ -33,7 +34,7 @@ export const usePostTravelogue = () => {
}),
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: QUERY_KEYS_MAP.travelogue.all,
queryKey: QUERY_KEYS_MAP.travelogue.me(),
refetchType: "inactive",
});
},
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/queries/usePutTravelPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface MutationFnVariables {

export const usePutTravelPlan = () => {
const queryClient = useQueryClient();

return useMutation<
AxiosResponse<TravelPlanResponse & { id: number }, unknown>,
ApiError | AxiosError<ErrorResponse>,
Expand Down Expand Up @@ -46,7 +47,7 @@ export const usePutTravelPlan = () => {
}),
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: QUERY_KEYS_MAP.travelPlan.all,
queryKey: QUERY_KEYS_MAP.travelPlan.me(),
refetchType: "inactive",
});
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/queries/usePutTravelogue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const usePutTravelogue = () => {
}),
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: QUERY_KEYS_MAP.travelogue.all,
queryKey: QUERY_KEYS_MAP.travelogue.me(),
refetchType: "inactive",
});
},
Expand Down

0 comments on commit 4a12de8

Please sign in to comment.