From e0e318fc46cb09f01266a48ef3e3e75044ed1a91 Mon Sep 17 00:00:00 2001 From: Anthony Date: Sun, 25 Jul 2021 23:31:46 +0200 Subject: [PATCH] show error on account connection page --- ui/page/settingsStripeAccount/index.js | 7 +++++-- ui/page/settingsStripeAccount/view.jsx | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ui/page/settingsStripeAccount/index.js b/ui/page/settingsStripeAccount/index.js index 633726701..87eb38809 100644 --- a/ui/page/settingsStripeAccount/index.js +++ b/ui/page/settingsStripeAccount/index.js @@ -2,12 +2,15 @@ import { connect } from 'react-redux'; import { withRouter } from 'react-router'; import StripeAccountConnection from './view'; import { selectUser } from 'redux/selectors/user'; +import { doToast } from 'redux/actions/notifications'; // function that receives state parameter and returns object of functions that accept state const select = (state) => ({ user: selectUser(state), }); -// const perform = (dispatch) => ({}); +const perform = (dispatch) => ({ + doToast: (options) => dispatch(doToast(options)), +}); -export default withRouter(connect(select)(StripeAccountConnection)); +export default withRouter(connect(select, perform)(StripeAccountConnection)); diff --git a/ui/page/settingsStripeAccount/view.jsx b/ui/page/settingsStripeAccount/view.jsx index 4276ca306..febfef6f3 100644 --- a/ui/page/settingsStripeAccount/view.jsx +++ b/ui/page/settingsStripeAccount/view.jsx @@ -31,6 +31,7 @@ if (isDev) { type Props = { source: string, user: User, + doOpenModal: (string, {}) => void, }; type State = { @@ -68,6 +69,8 @@ class StripeAccountConnection extends React.Component { componentDidMount() { const { user } = this.props; + let doToast = this.props.doToast; + // $FlowFixMe this.experimentalUiEnabled = user && user.experimental_ui; @@ -165,9 +168,13 @@ class StripeAccountConnection extends React.Component { // get stripe link and set it on the frontend getAndSetAccountLink(true); } else { + // probably an error from stripe + var displayString = 'There was an error getting your account setup, please let support know'; + doToast({ message: displayString, isError: true }); // not an error from Beamer, throw it throw new Error(error); } + }); }