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] },