From a849c3616d3be4b39fc0a16c9b2c0377caa97a63 Mon Sep 17 00:00:00 2001 From: jjangminii Date: Sun, 16 Nov 2025 20:56:26 +0900 Subject: [PATCH 1/2] feat: add query client for stamp status invalidation --- src/pages/main/node/[placeId].tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/pages/main/node/[placeId].tsx b/src/pages/main/node/[placeId].tsx index 34415ff..2d11ea6 100644 --- a/src/pages/main/node/[placeId].tsx +++ b/src/pages/main/node/[placeId].tsx @@ -16,6 +16,7 @@ import { useUserStatus } from '@/shared/hooks/useUserStatus'; import { useStampAcquire } from '@/shared/api/main/node/queries/useStampAcquire'; import { savePostcard } from '@/shared/utils/storage'; import { Skeleton } from '@/shared/components/skeleton/Skeleton'; +import { useQueryClient } from '@tanstack/react-query'; const Node = () => { const router = useRouter(); @@ -67,6 +68,8 @@ const Node = () => { const { isCompleted, imageUrl, placeName, description, address } = data.data; // 🔹 스탬프 찍기 버튼 + const queryClient = useQueryClient(); + const handleStampClick = () => { if (!isLoggedIn) { setShowLoginPopup(true); @@ -78,11 +81,8 @@ const Node = () => { getLocation( (pos) => { const body = { - latitude: 37.52146604044732, + latitude: 37.52146604044732, longitude: 126.76740151260397, - // 실제 위치 사용 시: - // latitude: pos.coords.latitude, - // longitude: pos.coords.longitude, }; const placeIdNum = Number(placeId); @@ -91,6 +91,9 @@ const Node = () => { { onSuccess: (res) => { const { postcard } = res.data; + + queryClient.invalidateQueries({ queryKey: ['stampStatus'] }); + savePostcard(postcard); router.push({ From 0b221bf4bdb39212b52bf5304c9c75a05fe4fd82 Mon Sep 17 00:00:00 2001 From: jjangminii Date: Sun, 16 Nov 2025 20:59:08 +0900 Subject: [PATCH 2/2] fix: remove duplicate queryClient declaration in Node component --- src/pages/main/node/[placeId].tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/main/node/[placeId].tsx b/src/pages/main/node/[placeId].tsx index 2d11ea6..c1708bf 100644 --- a/src/pages/main/node/[placeId].tsx +++ b/src/pages/main/node/[placeId].tsx @@ -24,6 +24,7 @@ const Node = () => { const [showLoginPopup, setShowLoginPopup] = useState(false); const [showErrorPopup, setShowErrorPopup] = useState(false); const { isLoggedIn } = useUserStatus(); + const queryClient = useQueryClient(); // 이미지 로딩 상태 const [imageLoaded, setImageLoaded] = useState(false); @@ -68,7 +69,6 @@ const Node = () => { const { isCompleted, imageUrl, placeName, description, address } = data.data; // 🔹 스탬프 찍기 버튼 - const queryClient = useQueryClient(); const handleStampClick = () => { if (!isLoggedIn) {