Simplify the onboardinf flow components
This commit is contained in:
@@ -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',
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user