Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit bd617e4

Browse files
committed
Fetch Account on Payment Success
1 parent 2e85a63 commit bd617e4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/lightning-core/pay/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import React from 'react'
33
import { connect } from 'react-redux'
44
import { Form, actions as formActions } from 'lightning-forms'
55
import { actions } from './reducer'
6+
import { actions as accountsActions } from '../accounts'
67
import { CurrencyInput, Head, Input, Page } from '../common'
78
import { sanitizePaymentRequest } from '../helpers'
89

9-
export const Pay = ({ onMakePayment, onDecodePaymentRequest, onEditForm }) => {
10+
export const Pay = ({ onMakePayment, onDecodePaymentRequest, onEditForm, onFetchAccount }) => {
1011
const fields = [
1112
{
1213
name: 'address',
@@ -24,7 +25,10 @@ export const Pay = ({ onMakePayment, onDecodePaymentRequest, onEditForm }) => {
2425

2526
const handleSuccess = ({ address, amount }, clear) => {
2627
onMakePayment({ address, amount })
27-
.then(clear)
28+
.then(() => {
29+
onFetchAccount()
30+
clear()
31+
})
2832
// eslint-disable-next-line no-console
2933
.catch(console.error)
3034
}
@@ -70,6 +74,7 @@ export default connect(
7074
onMakePayment: actions.makePayment,
7175
onDecodePaymentRequest: actions.decodePaymentRequest,
7276
onEditForm: formActions.editForm,
77+
onFetchAccount: accountsActions.fetchAccount,
7378
}
7479
)(Pay)
7580

0 commit comments

Comments
 (0)