bet row: auto-close dialog after a trade is submitted
This commit is contained in:
parent
d0a56cd1af
commit
3baffd4a35
|
@ -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)
|
||||
|
|
|
@ -38,6 +38,7 @@ export default function BetRow(props: {
|
|||
contract={props.contract}
|
||||
title={props.contract.question}
|
||||
selected={betChoice}
|
||||
onBetSuccess={() => setOpen(false)}
|
||||
/>
|
||||
</Modal>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user