Add debug logging to servidor list

- Added console.log statements to track data loading
- Better error messages with emojis and details
- Shows count of servidores, proveedores, tipos loaded
- Helps diagnose if data is not loading

This will help identify if:
- API endpoint is working
- Data is being returned
- Frontend is processing it correctly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Lizandro Guarnizo
2026-05-21 09:22:03 -05:00
co-authored by Copilot
parent 29820c8706
commit d1e56c8bd8
+14 -3
View File
@@ -399,6 +399,7 @@
this.limit = 10; this.limit = 10;
} }
this.setLoading(true); this.setLoading(true);
console.log('🔄 Cargando servidores desde:', '/app/loadservidor', {page: this.page, limit: this.limit, search: this.search});
axios.get('/app/loadservidor', { axios.get('/app/loadservidor', {
params: { params: {
page: this.page, page: this.page,
@@ -406,6 +407,8 @@
search: this.search search: this.search
} }
}).then(response => { }).then(response => {
console.log('✅ Respuesta recibida:', response.data);
if (response.data.registros && response.data.registros.length > 0) {
this.datos = response.data.registros.map(data => ({ this.datos = response.data.registros.map(data => ({
id: data.ID, id: data.ID,
nombre: data.nombre, nombre: data.nombre,
@@ -420,11 +423,17 @@
tipo_servidor_id: data.tipo_servidor_id, tipo_servidor_id: data.tipo_servidor_id,
created_at: data.CreatedAt, created_at: data.CreatedAt,
})); }));
console.log('📊 Servidores procesados:', this.datos.length);
} else {
console.warn('⚠️ No se encontraron servidores');
this.datos = [];
}
this.totalPages = response.data.totalPages; this.totalPages = response.data.totalPages;
this.calculatePaginatedPages(); this.calculatePaginatedPages();
}).catch(error => { }).catch(error => {
console.error('Error al obtener datos:', error); console.error('Error al obtener datos:', error);
alert('Error cargando servidores: ' + (error.response?.data?.message || error.message));
}).finally(() => { }).finally(() => {
this.setLoading(false); this.setLoading(false);
}); });
@@ -432,19 +441,21 @@
loadProvServidor() { loadProvServidor() {
axios.get('/app/loadprovservidor') axios.get('/app/loadprovservidor')
.then(response => { .then(response => {
console.log('✅ Proveedores cargados:', response.data.registros?.length || 0);
this.proveedores = response.data.registros; this.proveedores = response.data.registros;
}) })
.catch(error => { .catch(error => {
console.error('Error al cargar proveedores:', error); console.error('Error al cargar proveedores:', error);
}); });
}, },
loadTipoServidor() { loadTipoServidor() {
axios.get('/app/loadtiposervidor') axios.get('/app/loadtiposervidor')
.then(response => { .then(response => {
console.log('✅ Tipos de servidor cargados:', response.data.registros?.length || 0);
this.tipos = response.data.registros; this.tipos = response.data.registros;
}) })
.catch(error => { .catch(error => {
console.error('Error al cargar tipos de servidor:', error); console.error('Error al cargar tipos de servidor:', error);
}); });
}, },
setSelectedItem(data) { setSelectedItem(data) {