Fix issues
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user