fix carga de UUIDs en dashboard
All checks were successful
build-and-deploy / build (push) Successful in 24s
build-and-deploy / deploy (push) Successful in 11s

Aplica el mismo patrón que funciona en UuidSelector: intenta
uuids-with-names con fallback a uuids, y mapea correctamente
los datos para extraer solo los UUIDs.
This commit is contained in:
2025-08-16 01:34:16 -06:00
parent d378760b05
commit 3add7dfd6f

View File

@@ -265,16 +265,26 @@ const totalPlayers = computed(() => rooms.value.reduce((sum, room) => sum + room
onMounted(async () => {
// Try SSE first, fallback to polling if it fails
initSSE();
// Load allowed UUIDs from API
// Load allowed UUIDs from API (using same pattern as UuidSelector)
try {
const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:3000/api'}/admin/uuids`);
const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:3000/api'}/admin/uuids-with-names`);
if (!response.ok) {
console.warn('Failed to fetch uuids-with-names, trying fallback...');
// Fallback to regular UUIDs endpoint
const fallbackResponse = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:3000/api'}/admin/uuids`);
const fallbackData = await fallbackResponse.json();
allowedUuids.value = fallbackData.uuids || [];
} else {
const data = await response.json();
allowedUuids.value = data.uuids || [];
allowedUuids.value = (data.uuids || []).map((uuidInfo: any) => uuidInfo.uuid || uuidInfo);
}
if (!selectedUuid.value && allowedUuids.value.length > 0) {
selectedUuid.value = allowedUuids.value[0];
}
} catch {
console.error('Failed to load UUIDs from API');
} catch (error) {
console.error('Failed to load UUIDs from API:', error);
}
});