create: don't replace undefined antes

This commit is contained in:
mantikoros 2022-02-05 19:02:13 -06:00
parent 1c8c2a4126
commit fae28fed7c

View File

@ -62,9 +62,9 @@ export function NewContract(props: { question: string; tag?: string }) {
const [initialProb, setInitialProb] = useState(50) const [initialProb, setInitialProb] = useState(50)
const [description, setDescription] = useState('') const [description, setDescription] = useState('')
const [ante, setAnte] = useState<number | undefined>(undefined) const [ante, setAnte] = useState<number | undefined | null>(null)
useEffect(() => { useEffect(() => {
if (ante === undefined && creator) { if (ante === null && creator) {
const initialAnte = creator.balance < 100 ? 10 : 100 const initialAnte = creator.balance < 100 ? 10 : 100
setAnte(initialAnte) setAnte(initialAnte)
} }
@ -86,6 +86,7 @@ export function NewContract(props: { question: string; tag?: string }) {
initialProb < 100 && initialProb < 100 &&
question.length > 0 && question.length > 0 &&
ante !== undefined && ante !== undefined &&
ante !== null &&
ante >= MINIMUM_ANTE && ante >= MINIMUM_ANTE &&
ante <= balance && ante <= balance &&
// closeTime must be in the future // closeTime must be in the future