mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Pass the error message from the api up to the button's error handler
Remove the "Error:" prefix front he front-end facing error message The notice has already the error state and it's implied
This commit is contained in:
parent
74a4846861
commit
cfe450f835
6 changed files with 11 additions and 16 deletions
|
@ -19,8 +19,7 @@ class CartActionHandler {
|
|||
return res.json();
|
||||
}).then(function(data) {
|
||||
if (!data.success) {
|
||||
//Todo: Error handling
|
||||
return;
|
||||
throw Error(data.data);
|
||||
}
|
||||
return data.data.id;
|
||||
});
|
||||
|
@ -36,4 +35,4 @@ class CartActionHandler {
|
|||
}
|
||||
}
|
||||
|
||||
export default CartActionHandler;
|
||||
export default CartActionHandler;
|
||||
|
|
|
@ -41,8 +41,7 @@ class CheckoutActionHandler {
|
|||
return res.json();
|
||||
}).then(function (data) {
|
||||
if (!data.success) {
|
||||
//Todo: Error handling
|
||||
return;
|
||||
throw Error(data.data);
|
||||
}
|
||||
return data.data.id;
|
||||
});
|
||||
|
@ -57,4 +56,4 @@ class CheckoutActionHandler {
|
|||
}
|
||||
}
|
||||
|
||||
export default CheckoutActionHandler;
|
||||
export default CheckoutActionHandler;
|
||||
|
|
|
@ -15,7 +15,7 @@ class ErrorHandler {
|
|||
{
|
||||
const textarea = document.createElement('textarea');
|
||||
textarea.innerHTML = text;
|
||||
return textarea.value;
|
||||
return textarea.value.replace('Error: ', '');
|
||||
}
|
||||
|
||||
clear()
|
||||
|
@ -28,4 +28,4 @@ class ErrorHandler {
|
|||
}
|
||||
}
|
||||
|
||||
export default ErrorHandler;
|
||||
export default ErrorHandler;
|
||||
|
|
|
@ -83,8 +83,7 @@ class SingleProductActionHandler {
|
|||
return res.json();
|
||||
}).then(function (data) {
|
||||
if (!data.success) {
|
||||
//Todo: Error handling
|
||||
return;
|
||||
throw Error(data.data);
|
||||
}
|
||||
return data.data.id;
|
||||
});
|
||||
|
@ -123,4 +122,4 @@ class SingleProductActionHandler {
|
|||
return this.formElement.classList.contains('grouped_form');
|
||||
}
|
||||
}
|
||||
export default SingleProductActionHandler;
|
||||
export default SingleProductActionHandler;
|
||||
|
|
|
@ -10,8 +10,7 @@ const onApprove = (context) => {
|
|||
return res.json();
|
||||
}).then((data)=>{
|
||||
if (!data.success) {
|
||||
//Todo: Error handling
|
||||
return;
|
||||
throw Error(data.data);
|
||||
}
|
||||
location.href = context.config.redirect;
|
||||
});
|
||||
|
|
|
@ -10,8 +10,7 @@ const onApprove = (context) => {
|
|||
return res.json();
|
||||
}).then((data)=>{
|
||||
if (!data.success) {
|
||||
//Todo: Error handling
|
||||
return;
|
||||
throw Error(data.data);
|
||||
}
|
||||
document.querySelector('#place_order').click()
|
||||
});
|
||||
|
@ -19,4 +18,4 @@ const onApprove = (context) => {
|
|||
}
|
||||
}
|
||||
|
||||
export default onApprove;
|
||||
export default onApprove;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue