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 { class PayForm extends Component {
componentDidUpdate(prevProps) { 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 (isOnchain) { this.amountInput.focus() }
if ((prevProps.payInput !== payInput) && isLn) { // If LN go retrieve invoice details
console.log('go get the invoice') if ((prevProps.payform.payInput !== payInput) && isLn) {
fetchInvoice(payInput)
} }
} }
@ -21,15 +25,17 @@ class PayForm extends Component {
payform, payform,
currency, currency,
crypto, crypto,
isOnchain, isOnchain,
isLn, isLn,
inputCaption, inputCaption,
setPayAmount, setPayAmount,
setPayInput, setPayInput,
onPaySubmit onPaySubmit
} = this.props } = this.props
console.log('inputCaption: ', inputCaption)
return ( return (
<div className={styles.container}> <div className={styles.container}>
<section className={`${styles.amountContainer} ${isLn ? styles.ln : ''}`}> <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, setPayAmount: dispatchProps.setPayAmount,
setPayInput: dispatchProps.setPayInput, setPayInput: dispatchProps.setPayInput,
fetchInvoice: dispatchProps.fetchInvoice,
onPaySubmit: () => { onPaySubmit: () => {
console.log('do submit stuff') console.log('do submit stuff')

Loading…
Cancel
Save