File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 1
- import React from "react" ;
1
+ import React , { useState } from "react" ;
2
2
import history from "../history" ;
3
3
import { Router , Route , Switch } from 'react-router-dom' ;
4
4
import log from "loglevel"
@@ -17,12 +17,17 @@ import {BadRequest} from "./ui/error/badRequest";
17
17
18
18
const App = ( ) => {
19
19
log . info ( `[App]: Rendering App Component` )
20
+ const [ serverError , setServerError ] = useState ( false ) ;
21
+
22
+ const setServerErrorHandler = ( ) => {
23
+ setServerError ( true )
24
+ }
20
25
21
26
return (
22
27
< Router history = { history } >
23
- < NavBar />
28
+ < NavBar errorHandler = { setServerErrorHandler } />
24
29
< TabPanelList />
25
- < Switch >
30
+ { serverError ? null : < Switch >
26
31
< Route path = "/" exact component = { Home } />
27
32
< Route path = "/login" exact component = { Login } />
28
33
< Route path = "/signup" exact component = { SignUp } />
@@ -34,7 +39,7 @@ const App = () => {
34
39
< Route path = "/checkout/success-payment/:id" exact component = { SuccessPayment } />
35
40
< Route path = "/checkout/cancel-payment/:id" exact component = { CancelPayment } />
36
41
< Route path = "*" exact component = { BadRequest } />
37
- </ Switch >
42
+ </ Switch > }
38
43
</ Router >
39
44
)
40
45
}
Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ const NavBar = props => {
114
114
} else {
115
115
if ( tabsAPIData . hasOwnProperty ( "statusCode" ) ) {
116
116
log . info ( `[NavBar]: tabsAPIData.statusCode = ${ tabsAPIData . statusCode } ` )
117
+ props . errorHandler ( )
117
118
return < HTTPError statusCode = { tabsAPIData . statusCode } />
118
119
}
119
120
}
You can’t perform that action at this time.
0 commit comments