0
Fork 0
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:
Charles Zhao 2022-05-05 13:24:01 +08:00
parent 39bf3ccd8a
commit 2ed7b39214
No known key found for this signature in database
GPG key ID: 4858774754C92DF2
2 changed files with 43 additions and 43 deletions

View file

@ -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,6 +67,7 @@ const Main = () => {
}, [location.pathname, navigate]);
return (
<ErrorBoundary>
<SWRConfig value={{ fetcher }}>
<Toast />
<Routes>
@ -101,6 +103,7 @@ const Main = () => {
</Route>
</Routes>
</SWRConfig>
</ErrorBoundary>
);
};

View file

@ -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,7 +22,6 @@ const AppContent = () => {
}
return (
<ErrorBoundary>
<div className={styles.app}>
<Topbar />
<div className={styles.content}>
@ -33,7 +31,6 @@ const AppContent = () => {
</div>
</div>
</div>
</ErrorBoundary>
);
};