feat(frontend): adicionar link para perfil no ATUACAPES
- Adiciona ícone de link externo antes do nome do consultor
- Link abre perfil no ATUACAPES em nova aba (/perfil/{id_pessoa})
- Variável de ambiente HOST_ATUACAPES configurável
- Adiciona retry automático (10 tentativas) ao carregar ranking
- Corrige espaçamento da seção de selos
- Atualiza arquivos .env.example
This commit is contained in:
@@ -44,7 +44,10 @@ function App() {
|
||||
loadRanking();
|
||||
}, [page, pageSize]);
|
||||
|
||||
const loadRanking = async () => {
|
||||
const loadRanking = async (retryCount = 0) => {
|
||||
const MAX_RETRIES = 10;
|
||||
const RETRY_DELAY = 2000;
|
||||
|
||||
try {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
@@ -56,6 +59,14 @@ function App() {
|
||||
setPage(response.page || page);
|
||||
} catch (err) {
|
||||
const status = err?.response?.status;
|
||||
const isNetworkError = !err?.response || err?.code === 'ERR_NETWORK';
|
||||
|
||||
if (isNetworkError && retryCount < MAX_RETRIES) {
|
||||
setProcessMessage(`Aguardando API... (tentativa ${retryCount + 1}/${MAX_RETRIES})`);
|
||||
await new Promise((r) => setTimeout(r, RETRY_DELAY));
|
||||
return loadRanking(retryCount + 1);
|
||||
}
|
||||
|
||||
if (status === 503) {
|
||||
try {
|
||||
setProcessing(true);
|
||||
@@ -146,7 +157,7 @@ function App() {
|
||||
return (
|
||||
<div className="container">
|
||||
<div className="loading">
|
||||
{processing ? (processMessage || 'Processando ranking...') : 'Carregando ranking...'}
|
||||
{processMessage || (processing ? 'Processando ranking...' : 'Carregando ranking...')}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user