Fix app
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
// src/App.tsx
|
// src/App.tsx
|
||||||
import { useState, useEffect } from 'react';
|
import { useState } from 'react';
|
||||||
import { MunicipioWidget } from './components/MunicipioWidget';
|
import { MunicipioWidget } from './components/MunicipioWidget';
|
||||||
import { MunicipioSelector } from './components/MunicipioSelector';
|
import { MunicipioSelector } from './components/MunicipioSelector';
|
||||||
import { getMunicipios, type MunicipioSimple } from './services/api';
|
|
||||||
import './App.css';
|
import './App.css';
|
||||||
import { ResumenProvincialWidget } from './components/ResumenProvincialWidget';
|
import { ResumenProvincialWidget } from './components/ResumenProvincialWidget';
|
||||||
import { BancasWidget } from './components/BancasWidget';
|
import { BancasWidget } from './components/BancasWidget';
|
||||||
@@ -10,17 +9,6 @@ import { TelegramasView } from './components/TelegramasView';
|
|||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const [selectedMunicipioId, setSelectedMunicipioId] = useState<string | null>(null);
|
const [selectedMunicipioId, setSelectedMunicipioId] = useState<string | null>(null);
|
||||||
const [listaMunicipios, setListaMunicipios] = useState<MunicipioSimple[]>([]);
|
|
||||||
const [loading, setLoading] = useState(true);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getMunicipios()
|
|
||||||
.then(setListaMunicipios)
|
|
||||||
.catch(err => console.error("Error al cargar la lista de municipios", err))
|
|
||||||
.finally(() => setLoading(false));
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
if (loading) return <h1>Cargando datos iniciales...</h1>;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in New Issue
Block a user