Fixes for Javascript

This commit is contained in:
Benjamin Beganović 2021-08-18 17:48:02 +02:00
parent 41f31ff64c
commit 99da2128d1

View File

@ -68,6 +68,7 @@
constructor() {
this.appId = document.querySelector('meta[name=square-appId]').content;
this.locationId = document.querySelector('meta[name=square-locationId]').content;
this.isLoaded = false;
}
async init() {
@ -77,6 +78,8 @@
await this.card.attach('#card-container');
this.isLoaded = true;
let iframeContainer = document.querySelector('.sq-card-iframe-container');
if (iframeContainer) {
@ -151,11 +154,13 @@
document
.getElementById('toggle-payment-with-credit-card')
.addEventListener('click', async (element) => {
await this.init();
document.getElementById('card-container').classList.remove('hidden');
document.getElementById('save-card--container').style.display = 'grid';
document.querySelector('input[name=token]').value = "";
if (!this.isLoaded) {
await this.init();
}
});
let toggleWithToken = document.querySelector('.toggle-payment-with-token');