1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

Refactor purchase.next event handling in billing portal view

This commit is contained in:
Benjamin Beganović 2024-02-22 11:21:50 +01:00
parent fd4f24c9ad
commit b3a5b65af2

View File

@ -25,18 +25,15 @@
const target = document.getElementById('container');
const observer = new MutationObserver((mutationsList) => {
for (const mutation of mutationsList) {
if (mutation.type === 'childList' || mutation.type === 'subtree') {
setTimeout(() => {
document.getElementById('spinner').classList.add('hidden');
document.getElementById('container').classList.remove('hidden');
}, 1500);
}
}
});
Livewire.on('purchase.next', (event) => {
document.getElementById('spinner').classList.remove('hidden');
document.getElementById('container').classList.add('hidden');
observer.observe(target, { childList: true, subtree: true })
setTimeout(() => {
document.getElementById('spinner').classList.add('hidden');
document.getElementById('container').classList.remove('hidden');
}, 1500);
})
});
</script>
@endpush