Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/feat/#69'
Browse files Browse the repository at this point in the history
  • Loading branch information
kanguk01 committed Nov 13, 2024
2 parents a74939a + 989978a commit 1824259
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/api/hooks/useGeneratePlans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -28,7 +35,7 @@ const fetchGptData = async (
);
return {
...response.data,
planCards: transformPlanData(response.data.planCards), // 변환 함수 사용
planCards: convertToKST(transformPlanData(response.data.planCards)), // 변환 함수 사용
};
};

Expand Down
2 changes: 1 addition & 1 deletion src/pages/PreviewPlan/PreviewPlanSelectPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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] },
Expand Down

0 comments on commit 1824259

Please sign in to comment.