0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00

fix(console): fix loading and error handling for org details page (#6313)

This commit is contained in:
Xiao Yijun 2024-07-23 13:14:06 +08:00 committed by GitHub
parent 32e33487bd
commit 5ee47af00c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,10 +12,8 @@ import useSWR from 'swr';
import Delete from '@/assets/icons/delete.svg';
import File from '@/assets/icons/file.svg';
import OrganizationIcon from '@/assets/icons/organization-preview.svg';
import AppError from '@/components/AppError';
import DetailsPage from '@/components/DetailsPage';
import DetailsPageHeader from '@/components/DetailsPage/DetailsPageHeader';
import Skeleton from '@/components/DetailsPage/Skeleton';
import Drawer from '@/components/Drawer';
import PageMeta from '@/components/PageMeta';
import ThemedIcon from '@/components/ThemedIcon';
@ -31,7 +29,6 @@ import { OrganizationDetailsTabs, type OrganizationDetailsOutletContext } from '
const pathname = '/organizations';
// eslint-disable-next-line complexity
function OrganizationDetails() {
const { id } = useParams();
const { navigate } = useTenantPathname();
@ -70,14 +67,19 @@ function OrganizationDetails() {
(!jitEmailDomains.data && !jitEmailDomains.error) ||
(!jitRoles.data && !jitRoles.error) ||
(!jitSsoConnectors.data && !jitSsoConnectors.error);
const error =
organization.error ?? jitEmailDomains.error ?? jitRoles.error ?? jitSsoConnectors.error;
return (
<DetailsPage backLink={pathname} backLinkTitle="organizations.title" className={styles.page}>
<DetailsPage
backLink={pathname}
backLinkTitle="organizations.title"
className={styles.page}
isLoading={isLoading}
error={error}
>
<PageMeta titleKey="organization_details.page_title" />
{isLoading && <Skeleton />}
{error && <AppError errorCode={error.body?.code} errorMessage={error.body?.message} />}
{id &&
organization.data &&
jitEmailDomains.data &&