Allow set target on spinner

This commit is contained in:
dinamiko 2021-01-11 11:42:45 +01:00
parent 9bf0248153
commit aa91751450
2 changed files with 10 additions and 2 deletions

View file

@ -16,9 +16,12 @@ class CheckoutActionHandler {
const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ?
this.config.bn_codes[this.config.context] : '';
const errorHandler = this.errorHandler;
const formSelector = this.config.context === 'checkout' ? 'form.checkout' : 'form#order_review';
spinner.setTarget(formSelector);
spinner.block();
const formValues = jQuery(formSelector).serialize();
return fetch(this.config.ajax.create_order.endpoint, {

View file

@ -3,6 +3,11 @@ class Spinner {
constructor() {
this.target = 'form.woocommerce-checkout';
}
setTarget(target) {
this.target = target;
}
block() {
jQuery( this.target ).block({
@ -20,4 +25,4 @@ class Spinner {
}
}
export default Spinner;
export default Spinner;