bug no fetchErros encontrado e resolvido

This commit is contained in:
joao_pedro 2025-10-30 09:59:41 -03:00
parent a3bd204b88
commit 22fd2bf847
3 changed files with 8 additions and 3 deletions

View File

@ -6,7 +6,7 @@ function manager (setShowModal, RefreshingToken, setErrorInfo,errorData) {
if(errorData.httpStatus === 401){
RefreshingToken()
}else{
// setErrorInfo(errorData)
setErrorInfo(errorData)
setShowModal("modal");
}
}

View File

@ -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])

View File

@ -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)
});