Browse Source
fix(form): ensure amount > 0 when required
renovate/lint-staged-8.x
Tom Kirkpatrick
6 years ago
No known key found for this signature in database
GPG Key ID: 72203A8EC5967EA8
2 changed files with
4 additions and
4 deletions
-
app/components/UI/CryptoAmountInput.js
-
app/components/UI/FiatAmountInput.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) { |
|
|
|
@ -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) { |
|
|