Skip to content

Commit c7cb61b

Browse files
committed
refactor: 코드리뷰 반영
1 parent ca67b0b commit c7cb61b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

shared/api/mutations/capsule.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const useLikeToggle = () => {
3838
queryClient.invalidateQueries({
3939
queryKey: capsuleQueryKeys.detail(id),
4040
}),
41-
queryClient.invalidateQueries({ queryKey: capsuleQueryKeys.my() }),
41+
queryClient.invalidateQueries({ queryKey: ["capsule", "my"] }),
4242
]);
4343
},
4444
});
@@ -50,8 +50,13 @@ export const useLeaveCapsule = () => {
5050
mutationFn: (id: string) => {
5151
return apiClient.delete(ENDPOINTS.LEAVE_CAPSULE(id));
5252
},
53-
onSuccess: () => {
54-
queryClient.invalidateQueries({ queryKey: capsuleQueryKeys.my() });
53+
onSuccess: async (_data, id: string) => {
54+
await Promise.all([
55+
queryClient.invalidateQueries({ queryKey: ["capsule", "my"] }),
56+
queryClient.invalidateQueries({
57+
queryKey: capsuleQueryKeys.detail(id),
58+
}),
59+
]);
5560
},
5661
});
5762
};

0 commit comments

Comments
 (0)