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 block components
This commit is contained in:
parent
af7d4c7524
commit
8ce9e94bbb
1 changed files with 7 additions and 0 deletions
|
@ -3,6 +3,7 @@ import {
|
||||||
paypalSubscriptionToWcAddresses,
|
paypalSubscriptionToWcAddresses,
|
||||||
} from './Helper/Address';
|
} from './Helper/Address';
|
||||||
import ResumeFlowHelper from '../../../ppcp-button/resources/js/modules/Helper/ResumeFlowHelper';
|
import ResumeFlowHelper from '../../../ppcp-button/resources/js/modules/Helper/ResumeFlowHelper';
|
||||||
|
import Spinner from '../../../ppcp-button/resources/js/modules/Helper/Spinner';
|
||||||
|
|
||||||
export const createOrder = async ( data, config, onError, onClose ) => {
|
export const createOrder = async ( data, config, onError, onClose ) => {
|
||||||
try {
|
try {
|
||||||
|
@ -66,6 +67,10 @@ export const handleApprove = async (
|
||||||
onError,
|
onError,
|
||||||
onClose
|
onClose
|
||||||
) => {
|
) => {
|
||||||
|
// Block the entire page during approval process
|
||||||
|
const spinner = Spinner.fullPage();
|
||||||
|
spinner.block();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let order;
|
let order;
|
||||||
|
|
||||||
|
@ -173,6 +178,8 @@ export const handleApprove = async (
|
||||||
onClose();
|
onClose();
|
||||||
|
|
||||||
throw err;
|
throw err;
|
||||||
|
} finally {
|
||||||
|
spinner.unblock();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue