From 6c1c34e6926e3538b89ed13d0a967eb8b90d721a Mon Sep 17 00:00:00 2001 From: Brandon Smith Date: Sat, 2 Dec 2023 15:35:14 -0600 Subject: [PATCH] If we find ourselves on the payment screen without a payment intent, kick back to the purchase form --- front-end/src/components/Tickets.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/front-end/src/components/Tickets.tsx b/front-end/src/components/Tickets.tsx index 87999a6..ed6ef96 100644 --- a/front-end/src/components/Tickets.tsx +++ b/front-end/src/components/Tickets.tsx @@ -12,7 +12,7 @@ import MultiView from './core/MultiView' import { vibefetch } from '../vibefetch' import StripePaymentForm from './core/StripePaymentForm' -import { useRequest, useStable } from '../mobx/hooks' +import { useAutorun, useRequest, useStable } from '../mobx/hooks' import LoadingDots from './core/LoadingDots' import { makeAutoObservable } from 'mobx' import { Form, FormValidators } from '../mobx/form' @@ -71,6 +71,12 @@ export default observer(() => { const loading = Store.accountInfo.state.kind === 'loading' const loadingOrError = loading || Store.accountInfo.state.kind === 'error' + useAutorun(() => { + if (WindowObservables.hashState?.purchaseModalState === 'payment' && stripeOptions.state.kind === 'result' && stripeOptions.state.result == null) { + WindowObservables.assignHashState({ purchaseModalState: 'selection' }) + } + }) + return ( {Store.accountInfo.state.kind === 'result' &&