From 476659441387ff12af7da0c63942626c20281c71 Mon Sep 17 00:00:00 2001 From: karenvicent Date: Thu, 22 Jan 2026 10:58:47 -0500 Subject: [PATCH] fix function duplicated and log --- .../Incidents/hooks/useFetchIncidents.js | 23 ++++--------------- client/src/Pages/Incidents/index.jsx | 10 ++++---- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/client/src/Pages/Incidents/hooks/useFetchIncidents.js b/client/src/Pages/Incidents/hooks/useFetchIncidents.js index 3de495f8a..e308c9319 100644 --- a/client/src/Pages/Incidents/hooks/useFetchIncidents.js +++ b/client/src/Pages/Incidents/hooks/useFetchIncidents.js @@ -71,22 +71,11 @@ const useFetchIncidents = () => { }, [fetchIncidentsByTeam] ); - const fetchManualResolvedIncidents = useCallback( - async (config = {}) => { + + const fetchIncidentsByResolutionType = useCallback( + async (resolutionType, config = {}) => { await fetchIncidentsByTeam({ - status: false, - resolutionType: "manual", - sortOrder: "desc", - ...config, - }); - }, - [fetchIncidentsByTeam] - ); - const fetchAutomaticResolvedIncidents = useCallback( - async (config = {}) => { - await fetchIncidentsByTeam({ - status: false, - resolutionType: "automatic", + resolutionType, sortOrder: "desc", ...config, }); @@ -175,7 +164,6 @@ const useFetchIncidents = () => { createToast({ body: t("incidentsPage.errorResolvingIncident") }); } } catch (error) { - console.log("cayo a error"); setNetworkError(true); console.error(t("incidentsPage.errorResolvingIncident"), error); const errorMessage = @@ -220,8 +208,7 @@ const useFetchIncidents = () => { fetchIncidentById, resolveIncident, fetchIncidentSummary, - fetchManualResolvedIncidents, - fetchAutomaticResolvedIncidents, + fetchIncidentsByResolutionType, }; }; diff --git a/client/src/Pages/Incidents/index.jsx b/client/src/Pages/Incidents/index.jsx index 179002e18..3937512b6 100644 --- a/client/src/Pages/Incidents/index.jsx +++ b/client/src/Pages/Incidents/index.jsx @@ -49,8 +49,7 @@ const Incidents2 = () => { fetchActiveIncidents, fetchResolvedIncidents, resolveIncident, - fetchManualResolvedIncidents, - fetchAutomaticResolvedIncidents, + fetchIncidentsByResolutionType, } = useFetchIncidents(); const networkError = monitorsNetworkError || incidentsNetworkError; @@ -75,9 +74,9 @@ const Incidents2 = () => { } else if (filter === "resolved") { fetchResolvedIncidents(config); } else if (filter === "manual") { - fetchManualResolvedIncidents(config); + fetchIncidentsByResolutionType("manual", config); } else if (filter === "automatic") { - fetchAutomaticResolvedIncidents(config); + fetchIncidentsByResolutionType("automatic", config); } else { fetchIncidents(config); } @@ -91,8 +90,7 @@ const Incidents2 = () => { fetchActiveIncidents, fetchResolvedIncidents, fetchIncidents, - fetchManualResolvedIncidents, - fetchAutomaticResolvedIncidents, + fetchIncidentsByResolutionType, ]); useEffect(() => {