Simplify the onboardinf flow components

This commit is contained in:
Urtzi Alfaro
2025-09-08 17:19:00 +02:00
parent 201817a1be
commit 2e1e696cb5
32 changed files with 1431 additions and 6366 deletions

View File

@@ -92,13 +92,27 @@ export const useTenantStore = create<TenantState>()(
get().setCurrentTenant(tenants[0]);
}
} else {
throw new Error('Failed to load user tenants');
// No tenants found - this is fine for users who haven't completed onboarding
set({
availableTenants: [],
isLoading: false,
error: null
});
}
} catch (error) {
set({
isLoading: false,
error: error instanceof Error ? error.message : 'Failed to load tenants',
});
// Handle 404 gracefully - user might not have created any tenants yet
if (error && typeof error === 'object' && 'status' in error && error.status === 404) {
set({
availableTenants: [],
isLoading: false,
error: null,
});
} else {
set({
isLoading: false,
error: error instanceof Error ? error.message : 'Failed to load tenants',
});
}
}
},