From 049274c50b80d2f49b8de0aa86caa54cc4bcc89e Mon Sep 17 00:00:00 2001 From: 00kang Date: Tue, 2 Sep 2025 16:02:52 +0900 Subject: [PATCH 01/10] Refactor:#210 - remove refetchInterval and refetchOnWindowFocus from heatmap queries --- src/hooks/useHeatmap.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/hooks/useHeatmap.ts b/src/hooks/useHeatmap.ts index 9e42161c..38b7631d 100644 --- a/src/hooks/useHeatmap.ts +++ b/src/hooks/useHeatmap.ts @@ -10,8 +10,6 @@ export const useWeeklyHeatmap = (date: string, opts?: Opts) => { queryKey: ['weeklyHeatmap', date], queryFn: () => getWeeklyHeatmap(date), enabled: !!date && (opts?.enabled ?? true), - refetchInterval: 10 * 1000, // 10초마다 새로고침 - refetchOnWindowFocus: true, // 윈도우 포커스 시 새로고침 }); }; @@ -20,7 +18,5 @@ export const useMonthlyHeatmap = (yearMonth: string, opts?: Opts) => { queryKey: ['monthlyHeatmap', yearMonth], queryFn: () => getMonthlyHeatmap(yearMonth), enabled: !!yearMonth && (opts?.enabled ?? true), - refetchInterval: 10 * 1000, // 10초마다 새로고침 - refetchOnWindowFocus: true, // 윈도우 포커스 시 새로고침 }); }; From 8dd18da3d719be570455dfe8f670099275080785 Mon Sep 17 00:00:00 2001 From: 00kang Date: Tue, 2 Sep 2025 16:25:00 +0900 Subject: [PATCH 02/10] Feat:#210 - implement insight API with swagger-compliant interfaces and mocks --- src/api/insightApi.ts | 18 +++++++++++++ src/hooks/useInsight.ts | 25 ++++++++----------- src/interfaces/insight.ts | 17 ++++++------- src/mocks/handlers/insightHandlers.ts | 4 +-- .../insight/monthlyInsightResponse.ts | 9 ++----- .../insight/weeklyInsightResponse.ts | 8 ++---- 6 files changed, 41 insertions(+), 40 deletions(-) create mode 100644 src/api/insightApi.ts diff --git a/src/api/insightApi.ts b/src/api/insightApi.ts new file mode 100644 index 00000000..a13d31b9 --- /dev/null +++ b/src/api/insightApi.ts @@ -0,0 +1,18 @@ +import { getRequest } from '@/api'; +import { ApiMonthlyInsightResponse, ApiWeeklyInsightResponse } from '@/interfaces/insight'; + +export const getWeeklyInsight = async (date: string): Promise => { + const apiResponse: ApiWeeklyInsightResponse = await getRequest( + `/heatmaps/todo-timers/insight/weekly/${date}`, + ); + + return apiResponse; +}; + +export const getMonthlyInsight = async (yearMonth: string): Promise => { + const apiResponse: ApiMonthlyInsightResponse = await getRequest( + `/heatmaps/todo-timers/insight/monthly/${yearMonth}`, + ); + + return apiResponse; +}; diff --git a/src/hooks/useInsight.ts b/src/hooks/useInsight.ts index 53c1e8d4..1e48254a 100644 --- a/src/hooks/useInsight.ts +++ b/src/hooks/useInsight.ts @@ -1,23 +1,18 @@ import { useQuery } from '@tanstack/react-query'; -import { MonthlyInsightResponse, WeeklyInsightResponse } from '@/interfaces/insight'; +import { getMonthlyInsight, getWeeklyInsight } from '@/api/insightApi'; +import { ApiMonthlyInsightResponse, ApiWeeklyInsightResponse } from '@/interfaces/insight'; -export const useWeeklyInsight = () => { - return useQuery({ - queryKey: ['weeklyInsight'], - queryFn: async () => { - const res = await fetch('/insights/weekly'); - return res.json(); - }, +export const useWeeklyInsight = (date: string) => { + return useQuery({ + queryKey: ['weeklyInsight', date], + queryFn: async () => getWeeklyInsight(date), }); }; -export const useMonthlyInsight = () => { - return useQuery({ - queryKey: ['monthlyInsight'], - queryFn: async () => { - const res = await fetch('/insights/monthly'); - return res.json(); - }, +export const useMonthlyInsight = (yearMonth: string) => { + return useQuery({ + queryKey: ['monthlyInsight', yearMonth], + queryFn: async () => getMonthlyInsight(yearMonth), }); }; diff --git a/src/interfaces/insight.ts b/src/interfaces/insight.ts index db5954a0..17cb4cab 100644 --- a/src/interfaces/insight.ts +++ b/src/interfaces/insight.ts @@ -1,19 +1,16 @@ -// 주간 인사이트 응답 데이터 형식 -export interface WeeklyInsightResponse { +// API 명세서 기반 응답 타입 +export interface ApiWeeklyInsightResponse { success: boolean; data: { - week_start: string; - week_end: string; - insights: string[]; + date: string; + insights: string; }; } -// 월간 인사이트 응답 데이터 형식 -export interface MonthlyInsightResponse { +export interface ApiMonthlyInsightResponse { success: boolean; data: { - month: string; - month_name: string; - insights: string[]; + yearMonth: string; + insights: string; }; } diff --git a/src/mocks/handlers/insightHandlers.ts b/src/mocks/handlers/insightHandlers.ts index be55b55d..4988f755 100644 --- a/src/mocks/handlers/insightHandlers.ts +++ b/src/mocks/handlers/insightHandlers.ts @@ -4,11 +4,11 @@ import { monthlyInsightRes } from '@/mocks/mockResponses/insight/monthlyInsightR import { weeklyInsightRes } from '@/mocks/mockResponses/insight/weeklyInsightResponse'; export const insightsHandlers = [ - http.get('/insights/weekly', async () => { + http.get('/heatmaps/todo-timers/insight/weekly/:date', async () => { return HttpResponse.json(weeklyInsightRes); }), - http.get('/insights/monthly', () => { + http.get('/heatmaps/todo-timers/insight/monthly/:yearMonth', () => { return HttpResponse.json(monthlyInsightRes); }), ]; diff --git a/src/mocks/mockResponses/insight/monthlyInsightResponse.ts b/src/mocks/mockResponses/insight/monthlyInsightResponse.ts index 8d73c1db..a9e76c79 100644 --- a/src/mocks/mockResponses/insight/monthlyInsightResponse.ts +++ b/src/mocks/mockResponses/insight/monthlyInsightResponse.ts @@ -1,12 +1,7 @@ export const monthlyInsightRes = { success: true, data: { - month: '2024-01', - month_name: '1월', - insights: [ - '월초 대비 월말 작업량 23.5% 증가! 꾸준한 상승세', - '오후 집중도가 월간 베스트!', - '이번달 총 작업시간 213시간 45분, 지난달보다 33시간 45분 증가', - ], + yearMonth: '2025-09', + insights: '이번 달은 1주 차를 열심히 보냈네요!', }, }; diff --git a/src/mocks/mockResponses/insight/weeklyInsightResponse.ts b/src/mocks/mockResponses/insight/weeklyInsightResponse.ts index f27d429b..3a47ed43 100644 --- a/src/mocks/mockResponses/insight/weeklyInsightResponse.ts +++ b/src/mocks/mockResponses/insight/weeklyInsightResponse.ts @@ -1,11 +1,7 @@ export const weeklyInsightRes = { success: true, data: { - week_start: '2024-01-01', - week_end: '2024-01-07', - insights: [ - '이번주는 금요일이 10시간 20분으로 최고', - '이번주는 오후 집중도가 최고! 총 23시간 30분으로 압도적', - ], + date: '2025-09-02', + insights: '이번 주 골든 타임 1회 달성!', }, }; From 813c255dc1d857dee102beb11a05949ebc287820 Mon Sep 17 00:00:00 2001 From: 00kang Date: Tue, 2 Sep 2025 16:25:10 +0900 Subject: [PATCH 03/10] Feat:#210 - integrate insight data into heatmap components --- src/components/heatmaps/HeatmapSection.tsx | 49 ++++++++++++---------- src/components/insight/InsightCard.tsx | 8 ++-- src/hooks/useHeatmapsSection.ts | 4 +- 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/components/heatmaps/HeatmapSection.tsx b/src/components/heatmaps/HeatmapSection.tsx index ec620ed5..2806b88b 100644 --- a/src/components/heatmaps/HeatmapSection.tsx +++ b/src/components/heatmaps/HeatmapSection.tsx @@ -19,8 +19,14 @@ export default function HeatmapSection() { const [period, setPeriod] = useState<'week' | 'month'>('week'); const isWeek = period === 'week'; - const { weeklyHeatmapData, monthlyHeatmapData, hasError, handleRetry } = - useHeatmapSection(period); + const { + weeklyHeatmapData, + weeklyInsightData, + monthlyHeatmapData, + monthlyInsightData, + hasError, + handleRetry, + } = useHeatmapSection(period); const infoButtonRef = useRef(null); const cardContainerRef = useRef(null); @@ -48,26 +54,25 @@ export default function HeatmapSection() { // 인사이트 카드 렌더링 const renderInsightCard = () => { - return ; - - // TODO - // if (period === 'week') { - // return weeklyInsightData?.success && weeklyInsightData.data.insights.length > 0 ? ( - // - // ) : ( - // - // ); - // } - - // if (period === 'month') { - // return monthlyInsightData?.success && monthlyInsightData.data.insights.length > 0 ? ( - // - // ) : ( - // - // ); - // } - - // return null; + // return ; + + if (period === 'week') { + return weeklyInsightData?.success && weeklyInsightData.data.insights ? ( + + ) : ( + + ); + } + + if (period === 'month') { + return monthlyInsightData?.success && monthlyInsightData.data.insights ? ( + + ) : ( + + ); + } + + return null; }; const cardTitle = ( diff --git a/src/components/insight/InsightCard.tsx b/src/components/insight/InsightCard.tsx index 5c3f2bc4..4ab0b449 100644 --- a/src/components/insight/InsightCard.tsx +++ b/src/components/insight/InsightCard.tsx @@ -2,13 +2,13 @@ import { cn } from '@/lib/utils'; interface InsightCardProps { variant: 'no-data' | 'no-work-time' | 'weekly' | 'monthly'; - items?: React.ReactNode[]; + item?: string; className?: string; } import TimerIcon from '@/assets/icons/timer.svg'; -const InsightCard = ({ variant, items = [], className }: InsightCardProps) => { +const InsightCard = ({ variant, item = '', className }: InsightCardProps) => { const baseClasses = 'rounded-20 flex w-full flex-col py-12 px-12 md:px-20 bg-insightContainer gap-12 h-full'; @@ -51,9 +51,7 @@ const InsightCard = ({ variant, items = [], className }: InsightCardProps) => {
{title}
- {items.map((item, idx) => ( -

{item}

- ))} +

{item}

); diff --git a/src/hooks/useHeatmapsSection.ts b/src/hooks/useHeatmapsSection.ts index b205bc1c..c36f2aa7 100644 --- a/src/hooks/useHeatmapsSection.ts +++ b/src/hooks/useHeatmapsSection.ts @@ -13,8 +13,8 @@ export const useHeatmapSection = (period: 'week' | 'month') => { const weeklyHeatmap = useWeeklyHeatmap(getCurrentDate(), { enabled: isWeek }); const monthlyHeatmap = useMonthlyHeatmap(getCurrentMonth(), { enabled: !isWeek }); - const weeklyInsight = useWeeklyInsight(); - const monthlyInsight = useMonthlyInsight(); + const weeklyInsight = useWeeklyInsight(getCurrentDate()); + const monthlyInsight = useMonthlyInsight(getCurrentMonth()); const currentHeatmap = isWeek ? weeklyHeatmap : monthlyHeatmap; const currentInsight = isWeek ? weeklyInsight : monthlyInsight; From 0a8152e903403185c2114c9297678b44f6eb6686 Mon Sep 17 00:00:00 2001 From: 00kang Date: Tue, 2 Sep 2025 16:28:39 +0900 Subject: [PATCH 04/10] Refactor:#210 - implement comprehensive insight card state handling --- src/components/heatmaps/HeatmapSection.tsx | 30 +++++++++++++--------- src/components/insight/InsightCard.tsx | 4 +-- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/components/heatmaps/HeatmapSection.tsx b/src/components/heatmaps/HeatmapSection.tsx index 2806b88b..0fe79e6d 100644 --- a/src/components/heatmaps/HeatmapSection.tsx +++ b/src/components/heatmaps/HeatmapSection.tsx @@ -54,22 +54,28 @@ export default function HeatmapSection() { // 인사이트 카드 렌더링 const renderInsightCard = () => { - // return ; - if (period === 'week') { - return weeklyInsightData?.success && weeklyInsightData.data.insights ? ( - - ) : ( - - ); + if (!weeklyInsightData || !weeklyInsightData.success) { + return ; + } + + if (!weeklyInsightData.data.insights || weeklyInsightData.data.insights.trim() === '') { + return ; + } + + return ; } if (period === 'month') { - return monthlyInsightData?.success && monthlyInsightData.data.insights ? ( - - ) : ( - - ); + if (!monthlyInsightData || !monthlyInsightData.success) { + return ; + } + + if (!monthlyInsightData.data.insights || monthlyInsightData.data.insights.trim() === '') { + return ; + } + + return ; } return null; diff --git a/src/components/insight/InsightCard.tsx b/src/components/insight/InsightCard.tsx index 4ab0b449..3744c50b 100644 --- a/src/components/insight/InsightCard.tsx +++ b/src/components/insight/InsightCard.tsx @@ -19,8 +19,8 @@ const InsightCard = ({ variant, item = '', className }: InsightCardProps) => {

- 이번 주 작업 기록이 없어
- 인사이트를 제공할 수 없어요 :( + 작업 기록을 불러올 수 없어요
+ 잠시 후 다시 시도해주세요 :(

작업을 시작해보세요!

From 9c2a3fca143ca7f724888dc6d30bbabf3a7423a1 Mon Sep 17 00:00:00 2001 From: 00kang Date: Wed, 22 Oct 2025 18:14:53 +0900 Subject: [PATCH 05/10] feat(hooks): add query enable options to insight hooks --- src/hooks/useHeatmapsSection.ts | 4 ++-- src/hooks/useInsight.ts | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/hooks/useHeatmapsSection.ts b/src/hooks/useHeatmapsSection.ts index c36f2aa7..2d0a5f3c 100644 --- a/src/hooks/useHeatmapsSection.ts +++ b/src/hooks/useHeatmapsSection.ts @@ -13,8 +13,8 @@ export const useHeatmapSection = (period: 'week' | 'month') => { const weeklyHeatmap = useWeeklyHeatmap(getCurrentDate(), { enabled: isWeek }); const monthlyHeatmap = useMonthlyHeatmap(getCurrentMonth(), { enabled: !isWeek }); - const weeklyInsight = useWeeklyInsight(getCurrentDate()); - const monthlyInsight = useMonthlyInsight(getCurrentMonth()); + const weeklyInsight = useWeeklyInsight(getCurrentDate(), { enabled: isWeek }); + const monthlyInsight = useMonthlyInsight(getCurrentMonth(), { enabled: !isWeek }); const currentHeatmap = isWeek ? weeklyHeatmap : monthlyHeatmap; const currentInsight = isWeek ? weeklyInsight : monthlyInsight; diff --git a/src/hooks/useInsight.ts b/src/hooks/useInsight.ts index 1e48254a..ef7d48a9 100644 --- a/src/hooks/useInsight.ts +++ b/src/hooks/useInsight.ts @@ -3,16 +3,20 @@ import { useQuery } from '@tanstack/react-query'; import { getMonthlyInsight, getWeeklyInsight } from '@/api/insightApi'; import { ApiMonthlyInsightResponse, ApiWeeklyInsightResponse } from '@/interfaces/insight'; -export const useWeeklyInsight = (date: string) => { +type Opts = { enabled?: boolean }; + +export const useWeeklyInsight = (date: string, opts?: Opts) => { return useQuery({ queryKey: ['weeklyInsight', date], queryFn: async () => getWeeklyInsight(date), + enabled: !!date && (opts?.enabled ?? true), }); }; -export const useMonthlyInsight = (yearMonth: string) => { +export const useMonthlyInsight = (yearMonth: string, opts?: Opts) => { return useQuery({ queryKey: ['monthlyInsight', yearMonth], queryFn: async () => getMonthlyInsight(yearMonth), + enabled: !!yearMonth && (opts?.enabled ?? true), }); }; From e526c61f193bb6159521266f8f5f0ff4a115cac8 Mon Sep 17 00:00:00 2001 From: 00kang Date: Wed, 22 Oct 2025 18:15:11 +0900 Subject: [PATCH 06/10] refactor(insight): change insight data type to array --- src/interfaces/insight.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/interfaces/insight.ts b/src/interfaces/insight.ts index 17cb4cab..6e016753 100644 --- a/src/interfaces/insight.ts +++ b/src/interfaces/insight.ts @@ -3,7 +3,7 @@ export interface ApiWeeklyInsightResponse { success: boolean; data: { date: string; - insights: string; + insights: string[]; }; } @@ -11,6 +11,6 @@ export interface ApiMonthlyInsightResponse { success: boolean; data: { yearMonth: string; - insights: string; + insights: string[]; }; } From 52de62458ce4b8c50a3920626b74ee396dc816f5 Mon Sep 17 00:00:00 2001 From: 00kang Date: Wed, 22 Oct 2025 18:40:59 +0900 Subject: [PATCH 07/10] refactor(insight): support multiple insights and improve empty data handling --- src/components/heatmaps/HeatmapSection.tsx | 14 ++++++++++++-- src/components/insight/InsightCard.tsx | 8 ++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/components/heatmaps/HeatmapSection.tsx b/src/components/heatmaps/HeatmapSection.tsx index 0fe79e6d..b3b9526d 100644 --- a/src/components/heatmaps/HeatmapSection.tsx +++ b/src/components/heatmaps/HeatmapSection.tsx @@ -59,7 +59,12 @@ export default function HeatmapSection() { return ; } - if (!weeklyInsightData.data.insights || weeklyInsightData.data.insights.trim() === '') { + // insights가 배열이고 비어있거나, 모든 요소가 빈 문자열인 경우 + if ( + !weeklyInsightData.data.insights || + weeklyInsightData.data.insights.length === 0 || + weeklyInsightData.data.insights.every(insight => insight.trim() === '') + ) { return ; } @@ -71,7 +76,12 @@ export default function HeatmapSection() { return ; } - if (!monthlyInsightData.data.insights || monthlyInsightData.data.insights.trim() === '') { + // insights가 배열이고 비어있거나, 모든 요소가 빈 문자열인 경우 + if ( + !monthlyInsightData.data.insights || + monthlyInsightData.data.insights.length === 0 || + monthlyInsightData.data.insights.every(insight => insight.trim() === '') + ) { return ; } diff --git a/src/components/insight/InsightCard.tsx b/src/components/insight/InsightCard.tsx index 3744c50b..f40da324 100644 --- a/src/components/insight/InsightCard.tsx +++ b/src/components/insight/InsightCard.tsx @@ -2,7 +2,7 @@ import { cn } from '@/lib/utils'; interface InsightCardProps { variant: 'no-data' | 'no-work-time' | 'weekly' | 'monthly'; - item?: string; + item?: string | string[]; className?: string; } @@ -47,11 +47,15 @@ const InsightCard = ({ variant, item = '', className }: InsightCardProps) => { const title = variant === 'weekly' ? '[이번 주 목표 달성 인사이트]' : '[이번 달 목표 달성 인사이트]'; + const insights = Array.isArray(item) ? item : [item]; + return (
{title}
-

{item}

+ {insights.map((insight, index) => ( +

{insight}

+ ))}
); From b8454ffb405b655bc5e048b389bf55256239e297 Mon Sep 17 00:00:00 2001 From: 00kang Date: Thu, 23 Oct 2025 15:26:36 +0900 Subject: [PATCH 08/10] Fix:#210 - change insights type from string[] to string --- src/components/heatmaps/HeatmapSection.tsx | 14 ++------------ src/components/insight/InsightCard.tsx | 6 +----- src/interfaces/insight.ts | 4 ++-- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/components/heatmaps/HeatmapSection.tsx b/src/components/heatmaps/HeatmapSection.tsx index b3b9526d..0fe79e6d 100644 --- a/src/components/heatmaps/HeatmapSection.tsx +++ b/src/components/heatmaps/HeatmapSection.tsx @@ -59,12 +59,7 @@ export default function HeatmapSection() { return ; } - // insights가 배열이고 비어있거나, 모든 요소가 빈 문자열인 경우 - if ( - !weeklyInsightData.data.insights || - weeklyInsightData.data.insights.length === 0 || - weeklyInsightData.data.insights.every(insight => insight.trim() === '') - ) { + if (!weeklyInsightData.data.insights || weeklyInsightData.data.insights.trim() === '') { return ; } @@ -76,12 +71,7 @@ export default function HeatmapSection() { return ; } - // insights가 배열이고 비어있거나, 모든 요소가 빈 문자열인 경우 - if ( - !monthlyInsightData.data.insights || - monthlyInsightData.data.insights.length === 0 || - monthlyInsightData.data.insights.every(insight => insight.trim() === '') - ) { + if (!monthlyInsightData.data.insights || monthlyInsightData.data.insights.trim() === '') { return ; } diff --git a/src/components/insight/InsightCard.tsx b/src/components/insight/InsightCard.tsx index f40da324..a9641fef 100644 --- a/src/components/insight/InsightCard.tsx +++ b/src/components/insight/InsightCard.tsx @@ -47,15 +47,11 @@ const InsightCard = ({ variant, item = '', className }: InsightCardProps) => { const title = variant === 'weekly' ? '[이번 주 목표 달성 인사이트]' : '[이번 달 목표 달성 인사이트]'; - const insights = Array.isArray(item) ? item : [item]; - return (
{title}
- {insights.map((insight, index) => ( -

{insight}

- ))} +

{item}

); diff --git a/src/interfaces/insight.ts b/src/interfaces/insight.ts index 6e016753..17cb4cab 100644 --- a/src/interfaces/insight.ts +++ b/src/interfaces/insight.ts @@ -3,7 +3,7 @@ export interface ApiWeeklyInsightResponse { success: boolean; data: { date: string; - insights: string[]; + insights: string; }; } @@ -11,6 +11,6 @@ export interface ApiMonthlyInsightResponse { success: boolean; data: { yearMonth: string; - insights: string[]; + insights: string; }; } From 7a4baaca089e96b22ab31309d129b095278aa724 Mon Sep 17 00:00:00 2001 From: 00kang Date: Thu, 23 Oct 2025 18:38:43 +0900 Subject: [PATCH 09/10] Fix:#210 - simplify InsightCard prop and update stories accordingly --- src/components/insight/InsightCard.tsx | 2 +- src/stories/insight/InsightCard.stories.tsx | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/components/insight/InsightCard.tsx b/src/components/insight/InsightCard.tsx index a9641fef..3744c50b 100644 --- a/src/components/insight/InsightCard.tsx +++ b/src/components/insight/InsightCard.tsx @@ -2,7 +2,7 @@ import { cn } from '@/lib/utils'; interface InsightCardProps { variant: 'no-data' | 'no-work-time' | 'weekly' | 'monthly'; - item?: string | string[]; + item?: string; className?: string; } diff --git a/src/stories/insight/InsightCard.stories.tsx b/src/stories/insight/InsightCard.stories.tsx index 9f394b9a..f7814062 100644 --- a/src/stories/insight/InsightCard.stories.tsx +++ b/src/stories/insight/InsightCard.stories.tsx @@ -38,17 +38,13 @@ export const NoData: Story = { export const Weekly: Story = { args: { variant: 'weekly', - items: ['아침 시간대의 집중력이 높아요.', '목표 3개 중 2개를 성공적으로 달성했어요.'], + item: '이번 주 골든 타임 1회 달성!', }, }; export const Monthly: Story = { args: { variant: 'monthly', - items: [ - '가장 많이 활동한 요일은 화요일이에요.', - '전체 목표 달성률은 85%입니다.', - '작업 시간은 평균 3.2시간으로 꾸준했어요.', - ], + item: '이번 달은 1주 차를 열심히 보냈네요!', }, }; From 76fed696d2e3bec63e305962e941b472e1010d77 Mon Sep 17 00:00:00 2001 From: 00kang Date: Sun, 26 Oct 2025 15:36:34 +0900 Subject: [PATCH 10/10] Refactor:#210 - remove redundant async keyword in insight query functions --- src/hooks/useInsight.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/useInsight.ts b/src/hooks/useInsight.ts index ef7d48a9..6030e728 100644 --- a/src/hooks/useInsight.ts +++ b/src/hooks/useInsight.ts @@ -8,7 +8,7 @@ type Opts = { enabled?: boolean }; export const useWeeklyInsight = (date: string, opts?: Opts) => { return useQuery({ queryKey: ['weeklyInsight', date], - queryFn: async () => getWeeklyInsight(date), + queryFn: () => getWeeklyInsight(date), enabled: !!date && (opts?.enabled ?? true), }); }; @@ -16,7 +16,7 @@ export const useWeeklyInsight = (date: string, opts?: Opts) => { export const useMonthlyInsight = (yearMonth: string, opts?: Opts) => { return useQuery({ queryKey: ['monthlyInsight', yearMonth], - queryFn: async () => getMonthlyInsight(yearMonth), + queryFn: () => getMonthlyInsight(yearMonth), enabled: !!yearMonth && (opts?.enabled ?? true), }); };