mirror of
https://github.com/logto-io/logto.git
synced 2024-12-23 20:33:16 -05:00
refactor(console): promote error boundary to highest level
This commit is contained in:
parent
39bf3ccd8a
commit
2ed7b39214
2 changed files with 43 additions and 43 deletions
|
@ -8,6 +8,7 @@ import './scss/normalized.scss';
|
|||
import * as styles from './App.module.scss';
|
||||
import AppContent from './components/AppContent';
|
||||
import { getPath, sections } from './components/AppContent/components/Sidebar';
|
||||
import ErrorBoundary from './components/ErrorBoundary';
|
||||
import Toast from './components/Toast';
|
||||
import { themeStorageKey, logtoApiResource } from './consts';
|
||||
import { RequestError } from './hooks/use-api';
|
||||
|
@ -66,41 +67,43 @@ const Main = () => {
|
|||
}, [location.pathname, navigate]);
|
||||
|
||||
return (
|
||||
<SWRConfig value={{ fetcher }}>
|
||||
<Toast />
|
||||
<Routes>
|
||||
<Route path="callback" element={<Callback />} />
|
||||
<Route element={<AppContent />}>
|
||||
<Route path="*" element={<NotFound />} />
|
||||
<Route path="applications">
|
||||
<Route index element={<Applications />} />
|
||||
<Route path=":id">
|
||||
<Route index element={<Navigate to="settings" />} />
|
||||
<Route path="settings" element={<ApplicationDetails />} />
|
||||
<Route path="advanced-settings" element={<ApplicationDetails />} />
|
||||
<ErrorBoundary>
|
||||
<SWRConfig value={{ fetcher }}>
|
||||
<Toast />
|
||||
<Routes>
|
||||
<Route path="callback" element={<Callback />} />
|
||||
<Route element={<AppContent />}>
|
||||
<Route path="*" element={<NotFound />} />
|
||||
<Route path="applications">
|
||||
<Route index element={<Applications />} />
|
||||
<Route path=":id">
|
||||
<Route index element={<Navigate to="settings" />} />
|
||||
<Route path="settings" element={<ApplicationDetails />} />
|
||||
<Route path="advanced-settings" element={<ApplicationDetails />} />
|
||||
</Route>
|
||||
</Route>
|
||||
<Route path="api-resources">
|
||||
<Route index element={<ApiResources />} />
|
||||
<Route path=":id" element={<ApiResourceDetails />} />
|
||||
</Route>
|
||||
<Route path="connectors">
|
||||
<Route index element={<Connectors />} />
|
||||
<Route path="social" element={<Connectors />} />
|
||||
<Route path=":connectorId" element={<ConnectorDetails />} />
|
||||
</Route>
|
||||
<Route path="users">
|
||||
<Route index element={<Users />} />
|
||||
<Route path=":id" element={<UserDetails />} />
|
||||
</Route>
|
||||
<Route path="sign-in-experience">
|
||||
<Route index element={<Navigate to="experience" />} />
|
||||
<Route path=":tab" element={<SignInExperience />} />
|
||||
</Route>
|
||||
<Route path="settings" element={<Settings />} />
|
||||
</Route>
|
||||
<Route path="api-resources">
|
||||
<Route index element={<ApiResources />} />
|
||||
<Route path=":id" element={<ApiResourceDetails />} />
|
||||
</Route>
|
||||
<Route path="connectors">
|
||||
<Route index element={<Connectors />} />
|
||||
<Route path="social" element={<Connectors />} />
|
||||
<Route path=":connectorId" element={<ConnectorDetails />} />
|
||||
</Route>
|
||||
<Route path="users">
|
||||
<Route index element={<Users />} />
|
||||
<Route path=":id" element={<UserDetails />} />
|
||||
</Route>
|
||||
<Route path="sign-in-experience">
|
||||
<Route index element={<Navigate to="experience" />} />
|
||||
<Route path=":tab" element={<SignInExperience />} />
|
||||
</Route>
|
||||
<Route path="settings" element={<Settings />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
</SWRConfig>
|
||||
</Routes>
|
||||
</SWRConfig>
|
||||
</ErrorBoundary>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ import { useLogto } from '@logto/react';
|
|||
import React, { useEffect } from 'react';
|
||||
import { Outlet, useHref } from 'react-router-dom';
|
||||
|
||||
import ErrorBoundary from '../ErrorBoundary';
|
||||
import LogtoLoading from '../LogtoLoading';
|
||||
import Sidebar from './components/Sidebar';
|
||||
import Topbar from './components/Topbar';
|
||||
|
@ -23,17 +22,15 @@ const AppContent = () => {
|
|||
}
|
||||
|
||||
return (
|
||||
<ErrorBoundary>
|
||||
<div className={styles.app}>
|
||||
<Topbar />
|
||||
<div className={styles.content}>
|
||||
<Sidebar />
|
||||
<div className={styles.main}>
|
||||
<Outlet />
|
||||
</div>
|
||||
<div className={styles.app}>
|
||||
<Topbar />
|
||||
<div className={styles.content}>
|
||||
<Sidebar />
|
||||
<div className={styles.main}>
|
||||
<Outlet />
|
||||
</div>
|
||||
</div>
|
||||
</ErrorBoundary>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue