diff --git a/app/lnd/methods/index.js b/app/lnd/methods/index.js index b1a6266c..a891a453 100644 --- a/app/lnd/methods/index.js +++ b/app/lnd/methods/index.js @@ -97,7 +97,7 @@ export default function (lnd, event, msg, data) { // { amount, addr } = data walletController.sendCoins(lnd, data) .then(({ txid }) => event.sender.send('sendSuccessful', { amount: data.amount, addr: data.addr, txid })) - .catch(error => console.log('sendcoins error: ', error)) + .catch(error => event.sender.send('sendCoinsError', { error })) break case 'openChannel': // Response is empty. Streaming updates on channel status and updates diff --git a/app/reducers/ipc.js b/app/reducers/ipc.js index efee4e22..78988e07 100644 --- a/app/reducers/ipc.js +++ b/app/reducers/ipc.js @@ -19,7 +19,7 @@ import { pushclosechannelstatus } from './channels' -import { receivePayments, paymentSuccessful, sendSuccessful } from './payment' +import { receivePayments, paymentSuccessful, sendSuccessful, sendCoinsError } from './payment' import { receiveInvoices, createdInvoice, receiveFormInvoice } from './invoice' import { receiveBalance } from './balance' @@ -41,6 +41,7 @@ const ipc = createIpc({ paymentSuccessful, sendSuccessful, + sendCoinsError, channelSuccessful, pushchannelupdated, diff --git a/app/reducers/payment.js b/app/reducers/payment.js index c7927b8c..3fe6db5e 100644 --- a/app/reducers/payment.js +++ b/app/reducers/payment.js @@ -2,7 +2,7 @@ import { createSelector } from 'reselect' import { ipcRenderer } from 'electron' import { btc, usd } from '../utils' import { setForm, resetForm } from './form' -import { showModal } from './modal' +import { showModal, hideModal } from './modal' // ------------------------------------ // Constants @@ -88,6 +88,10 @@ export const sendSuccessful = (event, { amount, addr, txid }) => (dispatch) => { dispatch(resetForm()) } +export const sendCoinsError = (event, { error }) => (dispatch) => { + dispatch({ type: PAYMENT_FAILED }) +} + // ------------------------------------ // Action Handlers @@ -97,7 +101,8 @@ const ACTION_HANDLERS = { [GET_PAYMENTS]: state => ({ ...state, paymentLoading: true }), [SEND_PAYMENT]: state => ({ ...state, sendingPayment: true }), [RECEIVE_PAYMENTS]: (state, { payments }) => ({ ...state, paymentLoading: false, payments }), - [PAYMENT_SUCCESSFULL]: state => ({ ...state, sendingPayment: false }) + [PAYMENT_SUCCESSFULL]: state => ({ ...state, sendingPayment: false }), + [PAYMENT_FAILED]: state => ({ ...state, sendingPayment: false }) } const paymentSelectors = {}