bet panel: error handling

This commit is contained in:
mantikoros 2021-12-15 12:12:47 -06:00
parent a07d29b881
commit 3ee03ffcba

View File

@ -63,12 +63,18 @@ export function BetPanel(props: { contract: Contract; className?: string }) {
amount: betAmount,
outcome: betChoice,
contractId: contract.id,
})
}).then(r => r.data as any)
console.log('placed bet. Result:', result)
if (result?.status === 'success') {
setIsSubmitting(false)
setWasSubmitted(true)
setBetAmount(undefined)
} else {
setError(result?.error || 'Error placing bet')
setIsSubmitting(false)
}
}
const betDisabled = isSubmitting || !betAmount || error