Initial commit

This commit is contained in:
2025-12-05 11:27:16 -03:00
commit 804bacfbe3
87 changed files with 7260 additions and 0 deletions

32
frontend/js/config.js Normal file
View File

@@ -0,0 +1,32 @@
// Configuración de la API
const API_CONFIG = {
BASE_URL: 'http://localhost:8000/api',
// En producción cambiar a: BASE_URL: 'https://tu-dominio.com/api'
};
// Función helper para hacer requests
async function apiRequest(endpoint, options = {}) {
const url = `${API_CONFIG.BASE_URL}${endpoint}`;
const defaultOptions = {
headers: {
'Content-Type': 'application/json',
},
};
const config = { ...defaultOptions, ...options };
try {
const response = await fetch(url, config);
if (!response.ok) {
const error = await response.json().catch(() => ({ detail: 'Error desconocido' }));
throw new Error(error.detail || `Error ${response.status}`);
}
return await response.json();
} catch (error) {
console.error('API Error:', error);
throw error;
}
}