diff --git a/frontend/hooks/useReportList.ts b/frontend/hooks/useReportList.ts index e266f17d..8c99c409 100644 --- a/frontend/hooks/useReportList.ts +++ b/frontend/hooks/useReportList.ts @@ -1,4 +1,4 @@ -import { useState, useEffect, useCallback } from "react"; +import { useState, useEffect } from "react"; import { ReportMaster, GetReportsParams } from "@/types/report"; import { reportApi } from "@/lib/api/reportApi"; import { useToast } from "@/hooks/use-toast"; @@ -12,7 +12,7 @@ export function useReportList() { const [searchText, setSearchText] = useState(""); const { toast } = useToast(); - const fetchReports = useCallback(async () => { + const fetchReports = async () => { setIsLoading(true); try { const params: GetReportsParams = { @@ -31,6 +31,7 @@ export function useReportList() { setTotal(response.data.total); } } catch (error: any) { + console.error("리포트 목록 조회 에러:", error); toast({ title: "오류", description: error.message || "리포트 목록을 불러오는데 실패했습니다.", @@ -39,16 +40,17 @@ export function useReportList() { } finally { setIsLoading(false); } - }, [page, limit, searchText, toast]); + }; useEffect(() => { fetchReports(); - }, [fetchReports]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [page, searchText]); - const handleSearch = useCallback((text: string) => { + const handleSearch = (text: string) => { setSearchText(text); setPage(1); - }, []); + }; return { reports,