Browse Source

fix(payform): fix linting issues

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
26ad641a02
  1. 5
      app/reducers/payform.js
  2. 4
      app/routes/app/containers/AppContainer.js
  3. 3
      test/components/Form.spec.js

5
app/reducers/payform.js

@ -165,9 +165,8 @@ payFormSelectors.payFormIsValid = createSelector(
payFormSelectors.isOnchain, payFormSelectors.isOnchain,
payFormSelectors.isLn, payFormSelectors.isLn,
payAmountSelector, payAmountSelector,
payInputSelector, (isOnchain, isLn, amount) => {
(isOnchain, isLn, amount, invoice) => { const errors = {}
let errors = {}
if (!isLn && amount <= 0) { if (!isLn && amount <= 0) {
errors.amount = 'Amount must be more than 0' errors.amount = 'Amount must be more than 0'

4
app/routes/app/containers/AppContainer.js

@ -83,12 +83,12 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
fetchInvoice: dispatchProps.fetchInvoice, fetchInvoice: dispatchProps.fetchInvoice,
onPayAmountBlur: () => { onPayAmountBlur: () => {
// If the input is now valid and showErrors was on, turn it off // If the amount is now valid and showErrors was on, turn it off
if (stateProps.payFormIsValid.amountIsValid && stateProps.payform.showErrors.amount) { if (stateProps.payFormIsValid.amountIsValid && stateProps.payform.showErrors.amount) {
dispatchProps.updatePayErrors({ amount: false }) dispatchProps.updatePayErrors({ amount: false })
} }
// If the input is not valid and showErrors was off, turn it on // If the amount is not valid and showErrors was off, turn it on
if (!stateProps.payFormIsValid.amountIsValid && !stateProps.payform.showErrors.amount) { if (!stateProps.payFormIsValid.amountIsValid && !stateProps.payform.showErrors.amount) {
dispatchProps.updatePayErrors({ amount: true }) dispatchProps.updatePayErrors({ amount: true })
} }

3
test/components/Form.spec.js

@ -15,9 +15,12 @@ const payFormProps = {
currentAmount: '0', currentAmount: '0',
inputCaption: '', inputCaption: '',
showPayLoadingScreen: false, showPayLoadingScreen: false,
payFormIsValid: {},
setPayAmount: () => {}, setPayAmount: () => {},
onPayAmountBlur: () => {},
setPayInput: () => {}, setPayInput: () => {},
onPayInputBlur: () => {},
fetchInvoice: () => {}, fetchInvoice: () => {},

Loading…
Cancel
Save