Added error general error boundary page.

This commit is contained in:
Patrick Fic
2019-12-30 08:10:50 -08:00
parent 78448bbc91
commit 6f5eb87717
3 changed files with 70 additions and 35 deletions

View File

@@ -8,6 +8,7 @@ import "./App.css";
//Component Imports
import LoadingSpinner from "../components/loading-spinner/loading-spinner.component";
import AlertComponent from "../components/alert/alert.component";
import ErrorBoundary from "../components/error-boundary/error-boundary.component";
import { auth } from "../firebase/firebase.utils";
import { UPSERT_USER } from "../graphql/user.queries";
@@ -19,7 +20,9 @@ import PrivateRoute from "../utils/private-route";
const LandingPage = lazy(() => import("../pages/landing/landing.page"));
const ManagePage = lazy(() => import("../pages/manage/manage.page"));
const SignInPage = lazy(() => import("../pages/sign-in/sign-in.page"));
const Unauthorized = lazy(() => import("../pages/unauthorized/unauthorized.component"));
const Unauthorized = lazy(() =>
import("../pages/unauthorized/unauthorized.component")
);
export default () => {
const apolloClient = useApolloClient();
@@ -105,26 +108,28 @@ export default () => {
return (
<div>
<Switch>
<Suspense fallback={<div>Suspended Loading...</div>}>
<Route exact path="/" component={LandingPage} />
<Route exact path="/unauthorized" component={Unauthorized} />
<Route
exact
path="/signin"
render={() =>
HookCurrentUser.data.currentUser ? (
<Redirect to="/manage" />
) : (
<SignInPage />
)
}
/>
<PrivateRoute
isAuthorized={HookCurrentUser.data.currentUser ? true : false}
path="/manage"
component={ManagePage}
/>
</Suspense>
<ErrorBoundary>
<Suspense fallback={<div>Suspended Loading...</div>}>
<Route exact path="/" component={LandingPage} />
<Route exact path="/unauthorized" component={Unauthorized} />
<Route
exact
path="/signin"
render={() =>
HookCurrentUser.data.currentUser ? (
<Redirect to="/manage" />
) : (
<SignInPage />
)
}
/>
<PrivateRoute
isAuthorized={HookCurrentUser.data.currentUser ? true : false}
path="/manage"
component={ManagePage}
/>
</Suspense>
</ErrorBoundary>
</Switch>
</div>
);