bet row: auto-close dialog after a trade is submitted

This commit is contained in:
mantikoros 2022-02-05 12:26:11 -06:00
parent d0a56cd1af
commit 3baffd4a35
2 changed files with 4 additions and 1 deletions

View File

@ -41,13 +41,14 @@ export function BetPanel(props: {
className?: string
title?: string // Set if BetPanel is on a feed modal
selected?: 'YES' | 'NO'
onBetSuccess?: () => void
}) {
useEffect(() => {
// warm up cloud function
placeBet({}).catch()
}, [])
const { contract, className, title, selected } = props
const { contract, className, title, selected, onBetSuccess } = props
const user = useUser()
@ -96,6 +97,7 @@ export function BetPanel(props: {
setIsSubmitting(false)
setWasSubmitted(true)
setBetAmount(undefined)
if (onBetSuccess) onBetSuccess()
} else {
setError(result?.error || 'Error placing bet')
setIsSubmitting(false)

View File

@ -38,6 +38,7 @@ export default function BetRow(props: {
contract={props.contract}
title={props.contract.question}
selected={betChoice}
onBetSuccess={() => setOpen(false)}
/>
</Modal>
</div>