diff --git a/cryptide_project/src/App.tsx b/cryptide_project/src/App.tsx
index 408b5eb..68569cb 100644
--- a/cryptide_project/src/App.tsx
+++ b/cryptide_project/src/App.tsx
@@ -40,6 +40,10 @@ import 'bootstrap/dist/css/bootstrap.min.css';
import messagesFr from './Translations/fr.json';
import messagesEn from './Translations/en.json';
+/* Gestion d' erreur */
+import ErrorBoundary from './Error/ErrorBoundary';
+import ErrorPage from './Error/ErrorPage';
+
const messages = {
fr: messagesFr,
en: messagesEn,
@@ -69,31 +73,35 @@ function App() {
//
//
-
-
- {/*@ts-ignore*/}
-
-
-
- {hasNavbarVisible && }
-
- } />
- } />
- } />
- } />
- } />
- } />
- }/>
- } />
- } />
- }/>
- {/* }/> */}
-
-
-
-
-
-
+
+
+
+ {/*@ts-ignore*/}
+
+
+
+ {hasNavbarVisible && }
+
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ }/>
+ } />
+ } />
+ }/>
+ {/* }/> */}
+
+ } /> {/* page 404 */}
+
+
+
+
+
+
+
);
}
diff --git a/cryptide_project/src/Error/ErrorBoundary.tsx b/cryptide_project/src/Error/ErrorBoundary.tsx
new file mode 100644
index 0000000..dfd57e4
--- /dev/null
+++ b/cryptide_project/src/Error/ErrorBoundary.tsx
@@ -0,0 +1,67 @@
+import React, { Component, ErrorInfo, ReactNode } from 'react';
+import ErrorPage from './ErrorPage';
+
+interface ErrorBoundaryProps {
+ children: ReactNode;
+}
+
+interface ErrorBoundaryState {
+ hasError: boolean;
+}
+
+class ErrorBoundary extends Component {
+ constructor(props: ErrorBoundaryProps) {
+ super(props);
+ this.state = {
+ hasError: false,
+ };
+ }
+
+ static getDerivedStateFromError(): ErrorBoundaryState {
+ return { hasError: true };
+ }
+
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void {
+ // Vous pouvez également enregistrer l'erreur dans un service de journalisation
+ console.error('Error caught by ErrorBoundary:', error, errorInfo);
+ }
+
+ render(): ReactNode {
+ if (this.state.hasError) {
+ // Vous pouvez personnaliser cette partie avec une page d'erreur
+ //return Something went wrong. Please try again later.
;
+ return ;
+ }
+
+ return this.props.children;
+ }
+}
+
+export default ErrorBoundary;
+
+
+// interface ErrorBoundaryProps {
+// children: ReactNode;
+// }
+
+
+// class ErrorBoundary extends React.Component {
+// state = { hasError : true }
+// //@ts-ignore
+// static getDerivedStateFromError(error){
+// return { hasError : true};
+// }
+
+// componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {
+// console.log(error, errorInfo);
+// }
+
+// render(){
+// if (this.state.hasError){
+// return ;
+// }
+// return this.props.children;
+// }
+// }
+
+// export default ErrorBoundary;
\ No newline at end of file
diff --git a/cryptide_project/src/Error/ErrorPage.tsx b/cryptide_project/src/Error/ErrorPage.tsx
new file mode 100644
index 0000000..8097a66
--- /dev/null
+++ b/cryptide_project/src/Error/ErrorPage.tsx
@@ -0,0 +1,28 @@
+
+import React from 'react';
+import { useTheme } from '../Style/ThemeContext';
+import { Link } from 'react-router-dom';
+import './ErrorStyle.css';
+import { FormattedMessage } from 'react-intl';
+
+
+
+//@ts-ignore
+function ErrorPage({ msg = "Something is really wrong"}) {
+
+ const theme = useTheme();
+
+ // const mystyle = {
+ // backgroundColor: "#0064E0",
+ // };
+
+ return (
+
+ );
+}
+
+export default ErrorPage;
diff --git a/cryptide_project/src/Error/ErrorStyle.css b/cryptide_project/src/Error/ErrorStyle.css
new file mode 100644
index 0000000..4d18da9
--- /dev/null
+++ b/cryptide_project/src/Error/ErrorStyle.css
@@ -0,0 +1,15 @@
+
+.mainErrorDiv{
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+
+.titleError{
+ border: solid 2px #C70039;
+ border-radius: 10px;
+ margin: 15px;
+ padding: 10px;
+ box-shadow: 5px 5px 5px #900C3F;
+}
\ No newline at end of file