mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Block UI during onApprove callback on PayNow
Some checks are pending
CI / PHP 7.4 (push) Waiting to run
CI / PHP 8.0 (push) Waiting to run
CI / PHP 8.1 (push) Waiting to run
CI / PHP 8.2 (push) Waiting to run
CI / PHP 8.3 (push) Waiting to run
CI / PHP 8.4 (push) Waiting to run
PR Playground Demo / prepare_version (push) Waiting to run
PR Playground Demo / build_plugin (push) Blocked by required conditions
PR Playground Demo / create_archive (push) Blocked by required conditions
PR Playground Demo / Comment on PR with Playground details (push) Blocked by required conditions
Some checks are pending
CI / PHP 7.4 (push) Waiting to run
CI / PHP 8.0 (push) Waiting to run
CI / PHP 8.1 (push) Waiting to run
CI / PHP 8.2 (push) Waiting to run
CI / PHP 8.3 (push) Waiting to run
CI / PHP 8.4 (push) Waiting to run
PR Playground Demo / prepare_version (push) Waiting to run
PR Playground Demo / build_plugin (push) Blocked by required conditions
PR Playground Demo / create_archive (push) Blocked by required conditions
PR Playground Demo / Comment on PR with Playground details (push) Blocked by required conditions
This commit is contained in:
parent
02d05dc579
commit
da9f40980d
2 changed files with 8 additions and 3 deletions
|
@ -158,7 +158,7 @@ class CheckoutActionHandler {
|
|||
};
|
||||
return {
|
||||
createOrder,
|
||||
onApprove: onApprove( this, this.errorHandler, this.spinner ),
|
||||
onApprove: onApprove( this, this.errorHandler ),
|
||||
onCancel: () => {
|
||||
spinner.unblock();
|
||||
},
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
const onApprove = ( context, errorHandler, spinner ) => {
|
||||
import Spinner from '../Helper/Spinner';
|
||||
|
||||
const onApprove = ( context, errorHandler ) => {
|
||||
return ( data, actions ) => {
|
||||
const spinner = Spinner.fullPage();
|
||||
spinner.block();
|
||||
errorHandler.clear();
|
||||
|
||||
|
@ -19,7 +22,6 @@ const onApprove = ( context, errorHandler, spinner ) => {
|
|||
return res.json();
|
||||
} )
|
||||
.then( ( data ) => {
|
||||
spinner.unblock();
|
||||
if ( ! data.success ) {
|
||||
if ( data.data.code === 100 ) {
|
||||
errorHandler.message( data.data.message );
|
||||
|
@ -35,6 +37,9 @@ const onApprove = ( context, errorHandler, spinner ) => {
|
|||
throw new Error( data.data.message );
|
||||
}
|
||||
document.querySelector( '#place_order' ).click();
|
||||
} )
|
||||
.finally( () => {
|
||||
spinner.unblock();
|
||||
} );
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue