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 return
} }
try { try {
const validator = yup let validator = yup
.number() .number()
.positive() .positive()
.min(0) .min(0)
.typeError('A number is required') .typeError('A number is required')
if (required) { if (required) {
validator.required() validator = validator.required().moreThan(0)
} }
validator.validateSync(Number(value)) validator.validateSync(Number(value))
} catch (error) { } catch (error) {

4
app/components/UI/FiatAmountInput.js

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

Loading…
Cancel
Save