mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Add spinner and disable buttons while switching PUI checkbox
This commit is contained in:
parent
1f564f8b28
commit
eb8efc41f5
1 changed files with 5 additions and 0 deletions
|
@ -72,10 +72,13 @@ const ppcp_onboarding = {
|
|||
);
|
||||
|
||||
const onboard_pui = document.querySelector('#ppcp-onboarding-pui');
|
||||
const spinner = '<span class="spinner is-active" style="float: none;"></span>';
|
||||
onboard_pui?.addEventListener('click', (event) => {
|
||||
event.preventDefault();
|
||||
buttons.forEach((element) => {
|
||||
element.removeAttribute('href');
|
||||
element.setAttribute('disabled', 'disabled');
|
||||
jQuery(spinner).insertAfter(element);
|
||||
});
|
||||
|
||||
fetch(PayPalCommerceGatewayOnboarding.pui_endpoint, {
|
||||
|
@ -98,6 +101,8 @@ const ppcp_onboarding = {
|
|||
key = 'connect-to' + key.replace(/-/g, '');
|
||||
if(key === element.id) {
|
||||
element.setAttribute('href', value);
|
||||
element.removeAttribute('disabled')
|
||||
document.querySelector('.spinner').remove()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue