Browse Source

fix(sendcoins): clear form after successful send and add helpful comments

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
95745dcc4f
  1. 1
      app/reducers/form.js
  2. 8
      app/reducers/payment.js
  3. 2
      app/routes/app/components/components/ModalRoot/SuccessfulSendCoins/SuccessfulSendCoins.js

1
app/reducers/form.js

@ -101,7 +101,6 @@ formSelectors.isOnchain = createSelector(
bitcoin.address.toOutputScript(paymentRequest, bitcoin.networks.testnet)
return true
} catch (e) {
console.log('e: ', e)
return false
}
}

8
app/reducers/payment.js

@ -1,7 +1,7 @@
import { createSelector } from 'reselect'
import { ipcRenderer } from 'electron'
import { btc, usd } from '../utils'
import { setForm } from './form'
import { setForm, resetForm } from './form'
import { showModal } from './modal'
// ------------------------------------
@ -79,9 +79,13 @@ export const paymentSuccessful = () => fetchPayments()
export const sendSuccessful = (event, { amount, addr, txid }) => (dispatch) => {
// Close the form modal once the payment was succesful
dispatch(setForm({ modalOpen: false }))
// Show successful payment state
dispatch(showModal('SUCCESSFUL_SEND_COINS', { txid, amount, addr }))
// TODO: Add successful on-chain payment to payments list once payments list supports on-chain and LN
// dispatch({ type: PAYMENT_SUCCESSFULL, payment: { amount, addr, txid, pending: true } })
dispatch({ type: PAYMENT_SUCCESSFULL })
// Reset the payment form
dispatch(resetForm())
}
@ -94,7 +98,7 @@ const ACTION_HANDLERS = {
[SEND_PAYMENT]: state => ({ ...state, sendingPayment: true }),
[RECEIVE_PAYMENTS]: (state, { payments }) => ({ ...state, paymentLoading: false, payments }),
[PAYMENT_SUCCESSFULL]: (state, { payment }) => (
{ ...state, sendingPayment: false, payments: [payment, ...state.payments] }
{ ...state, sendingPayment: false }
)
}

2
app/routes/app/components/components/ModalRoot/SuccessfulSendCoins/SuccessfulSendCoins.js

@ -26,7 +26,7 @@ const SuccessfulSendCoins = ({ amount, addr, txid, hideModal, currentTicker, cur
}
SuccessfulSendCoins.propTypes = {
amount: PropTypes.oneOf([
amount: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string
]).isRequired,

Loading…
Cancel
Save