mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Show error messages for failed tracking
This commit is contained in:
parent
d5fef8d27f
commit
dc23c3357b
2 changed files with 4 additions and 1 deletions
|
@ -32,6 +32,9 @@ document.addEventListener(
|
||||||
return res.json();
|
return res.json();
|
||||||
}).then(function (data) {
|
}).then(function (data) {
|
||||||
if (!data.success) {
|
if (!data.success) {
|
||||||
|
jQuery( "<span class='error tracking-info-message'>" + data.data.message + "</span>" ).insertAfter(submitButton);
|
||||||
|
setTimeout(()=> jQuery('.tracking-info-message').remove(),3000);
|
||||||
|
submitButton.removeAttribute('disabled');
|
||||||
console.error(data);
|
console.error(data);
|
||||||
throw Error(data.data.message);
|
throw Error(data.data.message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ class OrderTrackingEndpoint {
|
||||||
|
|
||||||
wp_send_json_success( array( 'message' => $message ) );
|
wp_send_json_success( array( 'message' => $message ) );
|
||||||
} catch ( Exception $error ) {
|
} catch ( Exception $error ) {
|
||||||
wp_send_json_error( $error->getMessage(), 500 );
|
wp_send_json_error( array( 'message' => $error->getMessage() ), 500 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue