From 77337b8019c5e1580ff107c13413d10bec6bfa0f Mon Sep 17 00:00:00 2001 From: austinkelsay Date: Tue, 26 Nov 2024 16:00:10 -0600 Subject: [PATCH] fix onchange for course discount code --- .../bitcoinConnect/CoursePaymentButton.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/bitcoinConnect/CoursePaymentButton.js b/src/components/bitcoinConnect/CoursePaymentButton.js index fdef804..df5e17d 100644 --- a/src/components/bitcoinConnect/CoursePaymentButton.js +++ b/src/components/bitcoinConnect/CoursePaymentButton.js @@ -37,7 +37,7 @@ const CoursePaymentButton = ({ lnAddress, amount, onSuccess, onError, courseId } if (invoice) { intervalId = setInterval(async () => { const paid = await invoice.verifyPayment(); - + if (paid && invoice.preimage) { clearInterval(intervalId); // handle success @@ -47,7 +47,7 @@ const CoursePaymentButton = ({ lnAddress, amount, onSuccess, onError, courseId } } else { console.error('no invoice'); } - + return () => { if (intervalId) { clearInterval(intervalId); @@ -117,7 +117,7 @@ const CoursePaymentButton = ({ lnAddress, amount, onSuccess, onError, courseId } return (
{!showDiscountInput ? ( -