⏳ Cargando datos...
Mostrando datos por mes
// --- Init login (BL-59/BL-58) ---
(function initAuth() {
document.getElementById('login-form').addEventListener('submit', async (e) => {
e.preventDefault();
const u = document.getElementById('login-user').value.trim();
const p = document.getElementById('login-pass').value;
const err = document.getElementById('login-error');
err.textContent = '';
try {
await doLogin(u, p);
showApp();
if (typeof cargarDatos === 'function') cargarDatos();
else if (typeof init === 'function') init();
} catch(ex) {
err.textContent = ex.message;
}
});
if (getToken()) {
showApp();
if (typeof cargarDatos === 'function') cargarDatos();
else if (typeof init === 'function') init();
} else {
showLoginScreen();
}
})();