- Circuit breaker saludMonday (3 fallos → modo local; ping cada 60s)
- Endpoint GET /api/sistema/estado {mondayOk, pendientesSync}
- LeadCaptura extendida (board, etapa, origen, motivo, pendienteSync)
- Tablas Unidad (espejo inventario, 288 seed) + SyncPendiente
- crmLocal: crearLead, afluencia, cambio etapa, descarte, conversión, apartar
- Ruteo en controllers: fallback local ante 502 o Monday caído
- Mi día local: resumen completo desde SQLite + unión con Monday
- Fallbacks: unidades, contactos, reportes, prefill, buscador
- Sync worker cada 2min + handlers 15 tipos (con DependenciaPendienteError)
- Gate automatizaciones: skip si !mondayOk
- Banner 'Modo local' en 5 apps + badge pendiente en mi-dia
- 597 API tests + 263 front tests verdes
Env MODO_LOCAL_FORZADO=true para testing sin Monday.
20 lines
500 B
TypeScript
20 lines
500 B
TypeScript
import { conAuth, getToken } from './auth'
|
|
|
|
const API_URL = import.meta.env.VITE_API_URL ?? 'http://192.168.10.123:3000/api'
|
|
|
|
export interface EstadoSistema {
|
|
mondayOk: boolean
|
|
pendientesSync: number
|
|
}
|
|
|
|
export async function fetchEstadoSistema(): Promise<EstadoSistema | null> {
|
|
if (!getToken()) return null
|
|
try {
|
|
const res = await fetch(`${API_URL}/sistema/estado`, conAuth())
|
|
if (!res.ok) return null
|
|
return (await res.json()) as EstadoSistema
|
|
} catch {
|
|
return null
|
|
}
|
|
}
|