diff --git a/src/components/reports/ComprehensiveAnalysis/index.tsx b/src/components/reports/ComprehensiveAnalysis/index.tsx index 15d2a507..3f6e6718 100644 --- a/src/components/reports/ComprehensiveAnalysis/index.tsx +++ b/src/components/reports/ComprehensiveAnalysis/index.tsx @@ -280,28 +280,29 @@ export default function ComprehensiveAnalysis({ initialData }: ComprehensiveAnal const [rejectTargetId, setRejectTargetId] = useState(null); const [rejectReason, setRejectReason] = useState(''); - // 데이터 로드 (API 연동 시 활성화) - // const loadData = useCallback(async () => { - // setIsLoading(true); - // try { - // const result = await getComprehensiveAnalysis(); - // if (result.success && result.data) { - // setData(result.data); - // } - // } catch (error) { - // console.error('Failed to load comprehensive analysis:', error); - // } finally { - // setIsLoading(false); - // } - // }, []); - - // 초기 로드 - 현재 목데이터 사용 중 (API 연동 시 활성화) - useEffect(() => { - // API 연동 시 아래 주석 해제 - // loadData(); - setIsLoading(false); + // 데이터 로드 + const loadData = useCallback(async () => { + setIsLoading(true); + try { + const result = await getComprehensiveAnalysis(); + if (result.success && result.data) { + setData(result.data); + } else if (result.error) { + toast.error(result.error); + } + } catch (error) { + console.error('Failed to load comprehensive analysis:', error); + toast.error('데이터를 불러오는데 실패했습니다.'); + } finally { + setIsLoading(false); + } }, []); + // 초기 로드 + useEffect(() => { + loadData(); + }, [loadData]); + const handleReceivableDetail = () => { router.push('/ko/accounting/receivables-status'); }; @@ -370,12 +371,41 @@ export default function ComprehensiveAnalysis({ initialData }: ComprehensiveAnal ? data.todayIssue.items : data.todayIssue.items.filter(item => item.category === issueFilter); + if (isLoading) { + return ( + + +
+
+ +

데이터를 불러오는 중...

+
+
+
+ ); + } + return ( + + 새로고침 + + } />