mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-28 01:53:25 +00:00
Don't try to select a card if there is no select element
This error was being thrown when the user had no cards saved: ``` TypeError: stripeCardsController is null ```
This commit is contained in:
@@ -12,14 +12,15 @@ export default class extends Controller {
|
||||
|
||||
selectPaymentMethod(event) {
|
||||
this.doSelectPaymentMethod(event.target.dataset.paymentmethodId);
|
||||
const stripeCardsController =
|
||||
|
||||
const stripeCardSelector =
|
||||
this.application.getControllerForElementAndIdentifier(
|
||||
document
|
||||
.getElementById(event.target.dataset.paymentmethodId)
|
||||
.querySelector('[data-controller="stripe-cards"]'),
|
||||
"stripe-cards"
|
||||
);
|
||||
stripeCardsController.connect();
|
||||
stripeCardSelector?.connect();
|
||||
}
|
||||
|
||||
doSelectPaymentMethod(paymentMethodContainerId) {
|
||||
|
||||
Reference in New Issue
Block a user