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 (