Skip to content

Commit

Permalink
If we find ourselves on the payment screen without a payment intent, …
Browse files Browse the repository at this point in the history
…kick back to the purchase form
  • Loading branch information
brundonsmith committed Dec 2, 2023
1 parent f6cbfe6 commit 6c1c34e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion front-end/src/components/Tickets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 (
<Col padding={20} pageLevel justify={loadingOrError ? 'center' : undefined} align={loadingOrError ? 'center' : undefined}>
{Store.accountInfo.state.kind === 'result' &&
Expand Down

0 comments on commit 6c1c34e

Please sign in to comment.