From 22fd2bf847911fb6cbb09663daea9465fb828625 Mon Sep 17 00:00:00 2001 From: joao_pedro Date: Thu, 30 Oct 2025 09:59:41 -0300 Subject: [PATCH] bug no fetchErros encontrado e resolvido --- src/components/utils/fetchErros/ManagerFunction.js | 2 +- src/components/utils/fetchErros/ModalErro.jsx | 5 ++++- src/pages/TablePaciente.jsx | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/utils/fetchErros/ManagerFunction.js b/src/components/utils/fetchErros/ManagerFunction.js index eaa1e19..8efc8d2 100644 --- a/src/components/utils/fetchErros/ManagerFunction.js +++ b/src/components/utils/fetchErros/ManagerFunction.js @@ -6,7 +6,7 @@ function manager (setShowModal, RefreshingToken, setErrorInfo,errorData) { if(errorData.httpStatus === 401){ RefreshingToken() }else{ - // setErrorInfo(errorData) + setErrorInfo(errorData) setShowModal("modal"); } } diff --git a/src/components/utils/fetchErros/ModalErro.jsx b/src/components/utils/fetchErros/ModalErro.jsx index e3560d5..a08a0cf 100644 --- a/src/components/utils/fetchErros/ModalErro.jsx +++ b/src/components/utils/fetchErros/ModalErro.jsx @@ -16,7 +16,10 @@ if( ErrorData.httpStatus === 401){ console.log('uaua') }else if(ErrorData.httpStatus === 404){ setModalMensagem("Erro interno do sistema") -}else{setModalMensagem(ErrorData.mensagem)} +}else if(ErrorData.httpStatus === undefined){ + setModalMensagem("Erro operacional no sistema") +} +else{setModalMensagem(ErrorData.mensagem)} }, [ErrorData]) diff --git a/src/pages/TablePaciente.jsx b/src/pages/TablePaciente.jsx index 2358a6b..03f30b2 100644 --- a/src/pages/TablePaciente.jsx +++ b/src/pages/TablePaciente.jsx @@ -28,7 +28,7 @@ function TablePaciente({ setCurrentPage, setPatientID }) { const [showModalError, setShowModalError] = useState(""); - const [ ErrorInfo, setErrorInfo] = useState({}) + const [ErrorInfo, setErrorInfo] = useState({}) const GetAnexos = async (id) => { var myHeaders = new Headers(); @@ -138,6 +138,7 @@ function TablePaciente({ setCurrentPage, setPatientID }) { console.error("ERRO DETALHADO:", errorObject); throw errorObject; }); + } // 3. Se a resposta for OK (2xx), processamos o JSON normalmente @@ -151,6 +152,7 @@ function TablePaciente({ setCurrentPage, setPatientID }) { setShowModalError(false); }) .catch(error => { + console.error(error, "deu erro") manager(setShowModalError, RefreshingToken, setErrorInfo, error) });