Browse Source

feature(fetchInvoice): if LN fetch the invoice details

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
f761207bb7
  1. 14
      app/components/Form/PayForm.js
  2. 2
      app/routes/app/containers/AppContainer.js

14
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 (
<div className={styles.container}>
<section className={`${styles.amountContainer} ${isLn ? styles.ln : ''}`}>

2
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')

Loading…
Cancel
Save