From 989978a881c7e338aa6283940ae7e98bdc7afea1 Mon Sep 17 00:00:00 2001 From: faddishcorn Date: Wed, 13 Nov 2024 16:55:00 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=EC=83=9D=EC=84=B1=EB=90=9C=20plans=20?= =?UTF-8?q?kst=EB=B3=80=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/hooks/useGeneratePlans.ts | 9 ++++++++- src/pages/PreviewPlan/PreviewPlanSelectPage.tsx | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/api/hooks/useGeneratePlans.ts b/src/api/hooks/useGeneratePlans.ts index cd8cfbb..335e5ab 100644 --- a/src/api/hooks/useGeneratePlans.ts +++ b/src/api/hooks/useGeneratePlans.ts @@ -15,6 +15,13 @@ interface GptResponse { groupId: number; planCards: CalendarEvent[]; } +const convertToKST = (events: CalendarEvent[]): CalendarEvent[] => { + return events.map((event) => ({ + ...event, + start: new Date(new Date(event.start).getTime() + 9 * 60 * 60 * 1000), + end: new Date(new Date(event.end).getTime() + 9 * 60 * 60 * 1000), + })); +}; // gpt 요청 함수 - 동적 URL로 공통 함수 생성 const fetchGptData = async ( @@ -28,7 +35,7 @@ const fetchGptData = async ( ); return { ...response.data, - planCards: transformPlanData(response.data.planCards), // 변환 함수 사용 + planCards: convertToKST(transformPlanData(response.data.planCards)), // 변환 함수 사용 }; }; diff --git a/src/pages/PreviewPlan/PreviewPlanSelectPage.tsx b/src/pages/PreviewPlan/PreviewPlanSelectPage.tsx index ef98f9d..09fef72 100644 --- a/src/pages/PreviewPlan/PreviewPlanSelectPage.tsx +++ b/src/pages/PreviewPlan/PreviewPlanSelectPage.tsx @@ -72,7 +72,7 @@ const PreviewPlanSelectPage: React.FC = () => { const { mutate: fetchLightPlans } = useGptTrialLight(); const { mutate: fetchModeratePlans } = useGptTrialModerate(); const { mutate: fetchStrongPlans } = useGptTrialStrong(); - + const handleNextClick = async () => { navigate(RouterPath.PREVIEW_PLAN_UPDATE, { state: { plans: planCache[selectedLevel] },