diff --git a/client/src/App/App.js b/client/src/App/App.js
index 587e3356d..07fe638d4 100644
--- a/client/src/App/App.js
+++ b/client/src/App/App.js
@@ -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 (
- Suspended Loading...
}>
-
-
-
- HookCurrentUser.data.currentUser ? (
-
- ) : (
-
- )
- }
- />
-
-
+
+ Suspended Loading...}>
+
+
+
+ HookCurrentUser.data.currentUser ? (
+
+ ) : (
+
+ )
+ }
+ />
+
+
+
);
diff --git a/client/src/components/error-boundary/error-boundary.component.jsx b/client/src/components/error-boundary/error-boundary.component.jsx
new file mode 100644
index 000000000..63ae12f57
--- /dev/null
+++ b/client/src/components/error-boundary/error-boundary.component.jsx
@@ -0,0 +1,31 @@
+import React from "react";
+
+class ErrorBoundary extends React.Component {
+ constructor() {
+ super();
+ this.state = {
+ hasErrored: false,
+ error: null
+ };
+ }
+
+ static getDerivedStateFromError(error) {
+ //process the error
+ console.log("error", error);
+ return { hasErrored: true, error };
+ }
+
+ componentDidCatch(error, info) {
+ console.log("error", error);
+ console.log("info", info);
+ }
+
+ render() {
+ if (this.state.hasErrored === true) {
+ return Uh oh, something went wrong. {this.state.error}
;
+ } else {
+ return this.props.children;
+ }
+ }
+}
+export default ErrorBoundary;
diff --git a/client/src/pages/manage/manage.page.jsx b/client/src/pages/manage/manage.page.jsx
index 0aba41cea..2ea7d207d 100644
--- a/client/src/pages/manage/manage.page.jsx
+++ b/client/src/pages/manage/manage.page.jsx
@@ -3,12 +3,9 @@ import { Route } from "react-router";
import { Layout, BackTop } from "antd";
//Component Imports
-// import WhiteBoardPage from "../white-board/white-board.page";
-// import JobsPage from "../jobs/jobs.page";
-// import JobsDetailPage from "../jobs-detail/jobs-detail.page";
-
import HeaderContainer from "../../components/header/header.container";
import FooterComponent from "../../components/footer/footer.component";
+import ErrorBoundary from "../../components/error-boundary/error-boundary.component";
const WhiteBoardPage = lazy(() => import("../white-board/white-board.page"));
const JobsPage = lazy(() => import("../jobs/jobs.page"));
@@ -24,17 +21,19 @@ export default function Manage({ match }) {
- TODO: Suspended Loading in Manage Page...}
- >
-
+
+ TODO: Suspended Loading in Manage Page...}
+ >
+
-
-
-
+
+
+
+