This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +33
-2
lines changed Expand file tree Collapse file tree 5 files changed +33
-2
lines changed Original file line number Diff line number Diff line change
1
+ import React , { Component } from 'react' ;
2
+
3
+ export default class ErrorBoundary extends Component {
4
+ constructor ( props ) {
5
+ super ( props ) ;
6
+ this . state = { hasError : false } ;
7
+ }
8
+
9
+ static getDerivedStateFromError ( error ) {
10
+ console . log ( error ) ;
11
+ // Update state so the next render will show the fallback UI.
12
+ return { hasError : true } ;
13
+ }
14
+
15
+ componentDidCatch ( error , errorInfo ) {
16
+ // You can also log the error to an error reporting service
17
+ console . log ( error , errorInfo ) ;
18
+ }
19
+
20
+ render ( ) {
21
+ if ( this . state . hasError ) {
22
+ // You can render any custom fallback UI
23
+ return < h1 > Something went wrong.</ h1 > ;
24
+ }
25
+
26
+ return this . props . children ;
27
+ }
28
+ }
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ export { default as ErrorBoundary } from './ErrorBoundary' ;
2
+ export { default as Loader } from './Loader' ;
Original file line number Diff line number Diff line change 1
1
export { default as AuthRoute } from './AuthRoute' ;
2
- export { default as Loader } from './Loader' ;
3
2
export { default as PrivateRoute } from './PrivateRoute' ;
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import { Layout } from 'antd' ;
3
3
import { BrowserRouter , Switch , Route } from 'react-router-dom' ;
4
- import { AuthRoute , PrivateRoute , Loader } from './components/routes' ;
4
+ import { AuthRoute , PrivateRoute } from './components/routes' ;
5
+ import { Loader } from './components/common' ;
6
+
5
7
import * as Pages from './pages' ;
6
8
7
9
const { Content } = Layout ;
You can’t perform that action at this time.
0 commit comments