Trabajo de ajuste en widgets y db para frontend
This commit is contained in:
@@ -2,6 +2,51 @@
|
||||
import axios from 'axios';
|
||||
import type { ResumenProvincial, ProyeccionBancas, MunicipioSimple, TelegramaData, CatalogoItem } from './types/types';
|
||||
|
||||
interface PartidoData {
|
||||
id: string;
|
||||
nombre: string;
|
||||
nombreCorto: string | null;
|
||||
bancasTotales: number;
|
||||
color: string | null;
|
||||
}
|
||||
|
||||
interface CamaraData {
|
||||
camaraNombre: string;
|
||||
totalBancas: number;
|
||||
bancasEnJuego: number;
|
||||
partidos: PartidoData[];
|
||||
presidenteBancada: { color: string | null } | null;
|
||||
}
|
||||
|
||||
export interface ComposicionData {
|
||||
diputados: CamaraData;
|
||||
senadores: CamaraData;
|
||||
}
|
||||
|
||||
export interface OcupanteBanca {
|
||||
id: number;
|
||||
nombreOcupante: string;
|
||||
fotoUrl: string;
|
||||
periodo: string;
|
||||
}
|
||||
|
||||
interface PartidoData {
|
||||
id: string;
|
||||
nombre: string;
|
||||
nombreCorto: string | null;
|
||||
bancasTotales: number;
|
||||
bancasEnJuego: number;
|
||||
color: string | null;
|
||||
ocupantes: OcupanteBanca[];
|
||||
}
|
||||
|
||||
export interface BancadaDetalle {
|
||||
id: number; // Este es el ID de la Bancada
|
||||
camara: number; // 0 o 1
|
||||
agrupacionPoliticaId: string | null;
|
||||
ocupante: OcupanteBanca | null;
|
||||
}
|
||||
|
||||
const API_BASE_URL = 'http://localhost:5217/api';
|
||||
|
||||
const apiClient = axios.create({
|
||||
@@ -36,26 +81,36 @@ export const getTelegramaPorId = async (mesaId: string): Promise<TelegramaData>
|
||||
};
|
||||
|
||||
export const getSecciones = async (): Promise<CatalogoItem[]> => {
|
||||
const response = await apiClient.get('/catalogos/secciones');
|
||||
return response.data;
|
||||
const response = await apiClient.get('/catalogos/secciones');
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const getMunicipiosPorSeccion = async (seccionId: string): Promise<CatalogoItem[]> => {
|
||||
const response = await apiClient.get(`/catalogos/municipios/${seccionId}`);
|
||||
return response.data;
|
||||
const response = await apiClient.get(`/catalogos/municipios/${seccionId}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const getCircuitosPorMunicipio = async (municipioId: string): Promise<CatalogoItem[]> => {
|
||||
const response = await apiClient.get(`/catalogos/circuitos/${municipioId}`);
|
||||
return response.data;
|
||||
const response = await apiClient.get(`/catalogos/circuitos/${municipioId}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const getEstablecimientosPorCircuito = async (circuitoId: string): Promise<CatalogoItem[]> => {
|
||||
const response = await apiClient.get(`/catalogos/establecimientos/${circuitoId}`);
|
||||
return response.data;
|
||||
const response = await apiClient.get(`/catalogos/establecimientos/${circuitoId}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const getMesasPorEstablecimiento = async (establecimientoId: string): Promise<CatalogoItem[]> => {
|
||||
const response = await apiClient.get(`/catalogos/mesas/${establecimientoId}`);
|
||||
return response.data;
|
||||
const response = await apiClient.get(`/catalogos/mesas/${establecimientoId}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const getComposicionCongreso = async (): Promise<ComposicionData> => {
|
||||
const response = await apiClient.get('/resultados/composicion-congreso');
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const getBancadasDetalle = async (): Promise<BancadaDetalle[]> => {
|
||||
const response = await apiClient.get('/resultados/bancadas-detalle');
|
||||
return response.data;
|
||||
};
|
||||
Reference in New Issue
Block a user