Fix: Refresh de Datos Widgets
This commit is contained in:
@@ -47,7 +47,8 @@ export const HomeCarouselNacionalWidget = ({ eleccionId, categoriaId, titulo }:
|
||||
const { data, isLoading, error } = useQuery({
|
||||
queryKey: ['homeResumenNacional', eleccionId, categoriaId],
|
||||
queryFn: () => getHomeResumenNacional(eleccionId, categoriaId),
|
||||
});
|
||||
refetchInterval: 30000,
|
||||
})
|
||||
|
||||
if (isLoading) return <div>Cargando widget...</div>;
|
||||
if (error || !data) return <div>No se pudieron cargar los datos.</div>;
|
||||
|
||||
@@ -48,6 +48,7 @@ export const HomeCarouselWidget = ({ eleccionId, distritoId, categoriaId, titulo
|
||||
const { data, isLoading, error } = useQuery({
|
||||
queryKey: ['homeResumen', eleccionId, distritoId, categoriaId],
|
||||
queryFn: () => getHomeResumen(eleccionId, distritoId, categoriaId),
|
||||
refetchInterval: 30000,
|
||||
});
|
||||
|
||||
if (isLoading) return <div>Cargando widget...</div>;
|
||||
|
||||
@@ -73,6 +73,7 @@ const MobileResultsCard = ({
|
||||
const { data } = useSuspenseQuery<PanelElectoralDto>({
|
||||
queryKey: ['panelElectoral', eleccionId, ambitoId, categoriaId],
|
||||
queryFn: () => getPanelElectoral(eleccionId, ambitoId, categoriaId),
|
||||
refetchInterval: 30000,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@@ -157,6 +158,7 @@ const PanelContenido = ({ eleccionId, ambitoActual, categoriaId }: { eleccionId:
|
||||
const { data } = useSuspenseQuery<PanelElectoralDto>({
|
||||
queryKey: ['panelElectoral', eleccionId, ambitoActual.id, categoriaId],
|
||||
queryFn: () => getPanelElectoral(eleccionId, ambitoActual.id, categoriaId),
|
||||
refetchInterval: 30000,
|
||||
});
|
||||
// Si la API devolvió la bandera 'sinDatos', mostramos un mensaje.
|
||||
if (data.sinDatos) {
|
||||
|
||||
@@ -29,6 +29,7 @@ export const ResultadosNacionalesCardsWidget = ({
|
||||
focoCategoriaId,
|
||||
cantidadResultados
|
||||
}),
|
||||
refetchInterval: 30000,
|
||||
});
|
||||
|
||||
if (isLoading) return <div>Cargando resultados por provincia...</div>;
|
||||
|
||||
@@ -84,6 +84,7 @@ export const MapaNacional = ({ eleccionId, categoriaId, nivel, nombreAmbito, nom
|
||||
const response = await axios.get(url);
|
||||
return response.data;
|
||||
},
|
||||
refetchInterval: 30000,
|
||||
});
|
||||
|
||||
const { data: geoDataNacional } = useSuspenseQuery<any>({
|
||||
@@ -195,7 +196,7 @@ export const MapaNacional = ({ eleccionId, categoriaId, nivel, nombreAmbito, nom
|
||||
if (newZoom > initialProvincePositionRef.current.zoom) {
|
||||
toast.success('Desplazamiento Habilitado', {
|
||||
icon: '🖐️',
|
||||
style: { background: '#32e5f1ff', color: 'white', zIndex: 9999},
|
||||
style: { background: '#32e5f1ff', color: 'white', zIndex: 9999 },
|
||||
duration: 1000,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ export const MapaProvincial = ({ eleccionId, categoriaId, distritoId, nombreProv
|
||||
const response = await axios.get(url);
|
||||
return response.data;
|
||||
},
|
||||
refetchInterval: 30000,
|
||||
});
|
||||
|
||||
const { data: geoData } = useSuspenseQuery<any>({
|
||||
@@ -49,7 +50,7 @@ export const MapaProvincial = ({ eleccionId, categoriaId, distritoId, nombreProv
|
||||
if (municipioGeo) {
|
||||
const municipioFeature = feature(geoData, municipioGeo);
|
||||
const centroid = geoCentroid(municipioFeature);
|
||||
if(nombreProvincia.toUpperCase() === 'CAPITAL FEDERAL'){
|
||||
if (nombreProvincia.toUpperCase() === 'CAPITAL FEDERAL') {
|
||||
onCalculatedCenter(centroid as PointTuple, 180);
|
||||
} else {
|
||||
onCalculatedCenter(centroid as PointTuple, 10);
|
||||
|
||||
Reference in New Issue
Block a user