From 6584fbdd31506631072aabb45fa14aafcca61426 Mon Sep 17 00:00:00 2001 From: ooherin <555ohr@naver.com> Date: Thu, 24 Oct 2024 19:37:40 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20custom=20=EB=90=98=EB=A9=B4=20?= =?UTF-8?q?=EC=A7=88=EB=AC=B8=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20invalidate?= =?UTF-8?q?=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/hooks/query/usePutCustomChecklist.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/hooks/query/usePutCustomChecklist.ts b/frontend/src/hooks/query/usePutCustomChecklist.ts index 996aca1f7..549ca3a92 100644 --- a/frontend/src/hooks/query/usePutCustomChecklist.ts +++ b/frontend/src/hooks/query/usePutCustomChecklist.ts @@ -1,10 +1,15 @@ -import { useMutation } from '@tanstack/react-query'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; import { putCustomChecklist } from '@/apis/checklist'; +import { QUERY_KEYS } from '@/constants/queryKeys'; const usePutCustomChecklist = () => { + const queryClient = useQueryClient(); return useMutation({ mutationFn: (questionIds: number[]) => putCustomChecklist({ questionIds }), + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.CHECKLIST_QUESTIONS] }); + }, }); }; From e67e29a7a2b362b9dd1165ba768ae894cd288ba9 Mon Sep 17 00:00:00 2001 From: ooherin <555ohr@naver.com> Date: Thu, 24 Oct 2024 20:26:14 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20like=20v1=20=EB=B2=84=EC=A0=84?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/apis/checklist.ts | 2 +- frontend/src/apis/url.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/apis/checklist.ts b/frontend/src/apis/checklist.ts index c8cecf9e9..7ec6e1267 100644 --- a/frontend/src/apis/checklist.ts +++ b/frontend/src/apis/checklist.ts @@ -24,7 +24,7 @@ export const getChecklistDetail = async (id: number) => { export const getChecklists = async (isLikeFiltered: boolean = false) => { const response = await fetcher.get({ - url: BASE_URL + (isLikeFiltered ? ENDPOINT.CHECKLISTS_LIKE : ENDPOINT.CHECKLISTS_V1), + url: BASE_URL + (isLikeFiltered ? ENDPOINT.CHECKLISTS_LIKE_V1 : ENDPOINT.CHECKLISTS_V1), }); const data = await response.json(); return data.checklists.map(mapObjNullToUndefined).slice(0, 10); diff --git a/frontend/src/apis/url.ts b/frontend/src/apis/url.ts index 2108f462a..6b56d34db 100644 --- a/frontend/src/apis/url.ts +++ b/frontend/src/apis/url.ts @@ -7,6 +7,7 @@ export const ENDPOINT = { // checklist CHECKLISTS: '/checklists', CHECKLISTS_LIKE: '/checklists/like', + CHECKLISTS_LIKE_V1: '/v1/checklists/like', CHECKLISTS_V1: '/v1/checklists', CHECKLIST_QUESTION: '/checklists/questions', CHECKLIST_ALL_QUESTION: '/custom-checklist/all', From fd351c8c3c4161f38a4b812cd41f606dcf084a28 Mon Sep 17 00:00:00 2001 From: ooherin <555ohr@naver.com> Date: Thu, 24 Oct 2024 20:42:17 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20like=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/_common/Subway/SubwayStations.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/_common/Subway/SubwayStations.tsx b/frontend/src/components/_common/Subway/SubwayStations.tsx index 829c06026..1b1ba037e 100644 --- a/frontend/src/components/_common/Subway/SubwayStations.tsx +++ b/frontend/src/components/_common/Subway/SubwayStations.tsx @@ -13,7 +13,7 @@ interface Props { const SubwayStations = ({ stations }: Props) => { return ( <> - {stations.length ? ( + {stations?.length ? ( {stations?.map(station => )} ) : ( {'보신 방과 가까운 지하철역을 찾아드릴게요.'}