From f761207bb7b46e4c518412a63634aacb58a0028f Mon Sep 17 00:00:00 2001 From: Jack Mallers Date: Fri, 29 Sep 2017 18:00:09 -0500 Subject: [PATCH] feature(fetchInvoice): if LN fetch the invoice details --- app/components/Form/PayForm.js | 14 ++++++++++---- app/routes/app/containers/AppContainer.js | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/components/Form/PayForm.js b/app/components/Form/PayForm.js index dd65163a..95a5b3c3 100644 --- a/app/components/Form/PayForm.js +++ b/app/components/Form/PayForm.js @@ -8,11 +8,15 @@ import styles from './PayForm.scss' class PayForm extends Component { componentDidUpdate(prevProps) { - const { isOnchain, isLn, payform: { payInput } } = this.props + const { isOnchain, isLn, payform: { payInput }, fetchInvoice } = this.props + console.log('prevProps: ', prevProps) + console.log('props: ', this.props) + // If on-chain, focus on amount to let user know it's editable if (isOnchain) { this.amountInput.focus() } - if ((prevProps.payInput !== payInput) && isLn) { - console.log('go get the invoice') + // If LN go retrieve invoice details + if ((prevProps.payform.payInput !== payInput) && isLn) { + fetchInvoice(payInput) } } @@ -21,15 +25,17 @@ class PayForm extends Component { payform, currency, crypto, + isOnchain, isLn, inputCaption, + setPayAmount, setPayInput, + onPaySubmit } = this.props - console.log('inputCaption: ', inputCaption) return (
diff --git a/app/routes/app/containers/AppContainer.js b/app/routes/app/containers/AppContainer.js index 559d4d71..41701c8f 100644 --- a/app/routes/app/containers/AppContainer.js +++ b/app/routes/app/containers/AppContainer.js @@ -81,6 +81,8 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => { setPayAmount: dispatchProps.setPayAmount, setPayInput: dispatchProps.setPayInput, + fetchInvoice: dispatchProps.fetchInvoice, + onPaySubmit: () => { console.log('do submit stuff')