Browse Source

fix(form): ensure amount > 0 when required

renovate/lint-staged-8.x
Tom Kirkpatrick 6 years ago
parent
commit
a8c5a2d10f
No known key found for this signature in database GPG Key ID: 72203A8EC5967EA8
  1. 4
      app/components/UI/CryptoAmountInput.js
  2. 4
      app/components/UI/FiatAmountInput.js

4
app/components/UI/CryptoAmountInput.js

@ -121,13 +121,13 @@ class WrappedCryptoAmountInputAsField extends React.Component {
return
}
try {
const validator = yup
let validator = yup
.number()
.positive()
.min(0)
.typeError('A number is required')
if (required) {
validator.required()
validator = validator.required().moreThan(0)
}
validator.validateSync(Number(value))
} catch (error) {

4
app/components/UI/FiatAmountInput.js

@ -103,13 +103,13 @@ class WrappedFiatAmountInputAsField extends React.Component {
return
}
try {
const validator = yup
let validator = yup
.number()
.positive()
.min(0)
.typeError('A number is required')
if (required) {
validator.required()
validator = validator.required().moreThan(0)
}
validator.validateSync(Number(value))
} catch (error) {

Loading…
Cancel
Save