fix: add error states to OrgResolver, DashboardPage, AdminTenantsPage
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useLogto } from '@logto/react';
|
||||
import { Spinner } from '@cameleer/design-system';
|
||||
import { Button, EmptyState, Spinner } from '@cameleer/design-system';
|
||||
import { useMe } from '../api/hooks';
|
||||
import { useOrgStore } from './useOrganization';
|
||||
import { fetchConfig } from '../config';
|
||||
@@ -11,7 +11,7 @@ import { fetchConfig } from '../config';
|
||||
* Renders children once resolved.
|
||||
*/
|
||||
export function OrgResolver({ children }: { children: React.ReactNode }) {
|
||||
const { data: me, isLoading, isError } = useMe();
|
||||
const { data: me, isLoading, isError, refetch } = useMe();
|
||||
const { getAccessToken } = useLogto();
|
||||
const { getIdTokenClaims } = useLogto();
|
||||
const { setOrganizations, setCurrentOrg, setScopes, setUsername, currentOrgId } = useOrgStore();
|
||||
@@ -86,7 +86,17 @@ export function OrgResolver({ children }: { children: React.ReactNode }) {
|
||||
}
|
||||
|
||||
if (isError) {
|
||||
return null;
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', minHeight: '50vh', gap: '1rem' }}>
|
||||
<EmptyState
|
||||
title="Unable to load account"
|
||||
description="Failed to retrieve your organization. Please try again or contact support."
|
||||
/>
|
||||
<Button variant="secondary" size="sm" onClick={() => refetch()}>
|
||||
Retry
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return <>{children}</>;
|
||||
|
||||
Reference in New Issue
Block a user