show error on account connection page

This commit is contained in:
Anthony 2021-07-25 23:31:46 +02:00
parent b5aa5f82a2
commit d2c72775c0
No known key found for this signature in database
GPG key ID: C386D3C93D50E356
2 changed files with 12 additions and 2 deletions

View file

@ -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));

View file

@ -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<Props, State> {
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<Props, State> {
// 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);
}
});
}