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

Commit 1db3732

Browse files
committed
Cleanup transaction notification and add unitLabel to amount
1 parent c34cd69 commit 1db3732

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/action/transaction.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,15 @@ class TransactionAction {
147147

148148
async _receiveInvoice(invoice) {
149149
await this.update();
150-
if (invoice.settled) {
151-
const invoiceId = toHex(invoice.r_hash);
152-
let inv = this._store.computedTransactions.find(
153-
invoice => invoice.id === invoiceId
154-
);
155-
this._notification.display({
156-
msg: `Invoice success: received ${inv.amountLabel}`,
157-
handler: () => this.select({ item: inv }),
158-
handlerLbl: 'View details',
159-
});
160-
}
150+
if (!invoice.settled) return;
151+
const { computedTransactions, unitLabel } = this._store;
152+
let inv = computedTransactions.find(tx => tx.id === toHex(invoice.r_hash));
153+
this._notification.display({
154+
type: 'success',
155+
msg: `Invoice success: received ${inv.amountLabel} ${unitLabel}`,
156+
handler: () => this.select({ item: inv }),
157+
handlerLbl: 'View details',
158+
});
161159
}
162160
}
163161

0 commit comments

Comments
 (0)