diff --git a/client/src/components/error-boundary/error-boundary.component.jsx b/client/src/components/error-boundary/error-boundary.component.jsx index 96211cc00..cef01e299 100644 --- a/client/src/components/error-boundary/error-boundary.component.jsx +++ b/client/src/components/error-boundary/error-boundary.component.jsx @@ -3,6 +3,16 @@ import React from "react"; import { withTranslation } from "react-i18next"; import { logImEXEvent } from "../../firebase/firebase.utils"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { selectCurrentUser } from "../../redux/user/user.selectors"; +const mapStateToProps = createStructuredSelector({ + currentUser: selectCurrentUser, +}); +const mapDispatchToProps = (dispatch) => ({ + //setUserLanguage: language => dispatch(setUserLanguage(language)) +}); + class ErrorBoundary extends React.Component { constructor() { super(); @@ -23,6 +33,24 @@ class ErrorBoundary extends React.Component { this.setState({ ...this.state, error, info }); } + handleErrorSubmit = () => { + const errorDescription = `**Please add relevant details about what you were doing before you encountered this issue** + +---- +System Generated Log: +${this.state.error.message} +${this.state.error.stack} + `; + + const URL = `https://bodyshop.atlassian.net/servicedesk/customer/portal/3/group/8/create/26?summary=123&description=${encodeURI( + errorDescription + )}&customfield_10049=${window.location}&email=${ + this.props.currentUser.email + }`; + console.log(`URL`, URL); + window.open(URL, "_blank"); + }; + render() { const { t } = this.props; const { error, info } = this.state; @@ -32,22 +60,20 @@ class ErrorBoundary extends React.Component { return (
- @@ -72,4 +98,8 @@ class ErrorBoundary extends React.Component { } } } -export default withTranslation()(ErrorBoundary); + +export default connect( + mapStateToProps, + mapDispatchToProps +)(withTranslation()(ErrorBoundary));