Fix issues

This commit is contained in:
Urtzi Alfaro
2025-08-17 10:28:58 +02:00
parent 8914786973
commit 109961ef6e
10 changed files with 450 additions and 176 deletions

View File

@@ -120,7 +120,20 @@ export class TenantService {
console.log('📦 TenantService: API response:', result);
console.log('📏 TenantService: Response length:', Array.isArray(result) ? result.length : 'Not an array');
if (Array.isArray(result) && result.length > 0) {
// Ensure we always return an array
if (!Array.isArray(result)) {
console.warn('⚠️ TenantService: Response is not an array, converting...');
// If it's an object with numeric keys, convert to array
if (result && typeof result === 'object') {
const converted = Object.values(result);
console.log('🔄 TenantService: Converted to array:', converted);
return converted as TenantInfo[];
}
console.log('🔄 TenantService: Returning empty array');
return [];
}
if (result.length > 0) {
console.log('✅ TenantService: First tenant:', result[0]);
console.log('🆔 TenantService: First tenant ID:', result[0]?.id);
}