Feat Widgets 1930
This commit is contained in:
@@ -140,8 +140,8 @@ export const getResultadosConcejales = async (seccionId: string): Promise<Result
|
||||
};
|
||||
|
||||
export const getDetalleSeccion = async (seccionId: string, categoriaId: number): Promise<ResultadoDetalleSeccion[]> => {
|
||||
const response = await apiClient.get(`/resultados/seccion/${seccionId}?categoriaId=${categoriaId}`);
|
||||
return response.data;
|
||||
const response = await apiClient.get(`/resultados/seccion/${seccionId}?categoriaId=${categoriaId}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const getResultadosPorMunicipioYCategoria = async (municipioId: string, categoriaId: number): Promise<ResultadoTicker[]> => {
|
||||
@@ -149,7 +149,18 @@ export const getResultadosPorMunicipioYCategoria = async (municipioId: string, c
|
||||
return response.data.resultados;
|
||||
};
|
||||
|
||||
export const getMunicipios = async (): Promise<MunicipioSimple[]> => {
|
||||
const response = await apiClient.get('/catalogos/municipios');
|
||||
return response.data;
|
||||
export const getResultadosPorMunicipio = async (municipioId: string, categoriaId: number): Promise<ResultadoTicker[]> => {
|
||||
const response = await apiClient.get(`/resultados/partido/${municipioId}?categoriaId=${categoriaId}`);
|
||||
// La respuesta es un objeto, nosotros extraemos el array de resultados
|
||||
return response.data.resultados;
|
||||
};
|
||||
|
||||
export const getMunicipios = async (categoriaId?: number): Promise<MunicipioSimple[]> => {
|
||||
let url = '/catalogos/municipios';
|
||||
if (categoriaId) {
|
||||
url += `?categoriaId=${categoriaId}`;
|
||||
}
|
||||
const response = await apiClient.get(url);
|
||||
// La API ahora devuelve { seccionId, nombre }, lo mapeamos a { id, nombre }
|
||||
return response.data.map((m: any) => ({ id: m.seccionId, nombre: m.nombre }));
|
||||
};
|
||||
Reference in New Issue
Block a user