Commit 8bfeda3e authored by Florent Chehab's avatar Florent Chehab

feature(go home on bug) & changelog added

parent e1e43648
Pipeline #44489 passed with stages
in 4 minutes and 7 seconds
### [Versions](https://material-ui.com/versions/)
## Next
###### *TBD*
- [feature] Possible to go back to home on frontend crash
## v1.0.0
###### *23 Aug 2019*
- Opening of the app
......@@ -6,6 +6,8 @@ import getActions from "../../redux/api/getActions";
import compose from "recompose/compose";
import {connect} from "react-redux";
import {RequestParams} from "../../redux/api/RequestParams";
import {withRouter} from "react-router-dom";
import {APP_ROUTES} from "../../config/appRoutes";
function clear() {
return {error: null, errorInfo: null, alertOpen: true};
......@@ -42,11 +44,15 @@ class ErrorBoundary extends React.Component {
console.log(error, errorInfo);
return (
<Alert open={this.state.alertOpen}
info={true}
info={false}
title={"Une erreur inconnue c'est produite dans l'application. Nous vous prions de nous en excuser."}
description={"Nous vous invitons à recharger la page. Si l'erreur persiste, merci de contacter les administrateurs du site; l'erreur leur a été transmise."}
infoText={"C'est noté, je sais que vous faîtes de votre mieux :)"}
handleResponse={() => undefined}
agreeText={"C'est noté, je sais que vous faîtes de votre mieux :)"}
disagreeText={"Retourner à l'accueil"}
handleResponse={(agreed) => {
// May need to click twice, but there seem to be no other ways
if (!agreed) this.props.history.push(APP_ROUTES.base);
}}
handleClose={() => this.setState(clear())}
/>
);
......@@ -60,6 +66,7 @@ class ErrorBoundary extends React.Component {
ErrorBoundary.propTypes = {
children: PropTypes.node.isRequired,
logErrorOnServer: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
};
......@@ -69,7 +76,8 @@ const mapDispatchToProps = (dispatch) => ({
const ConnectedErrorBoundary = compose(
connect(() => ({}), mapDispatchToProps)
connect(() => ({}), mapDispatchToProps),
withRouter
)(ErrorBoundary);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment