mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
PPv2: Surface error-messages if XHR-call fails
This commit is contained in:
@@ -198,7 +198,12 @@ var pretixpaypal = {
|
|||||||
}).then(function (res) {
|
}).then(function (res) {
|
||||||
return res.json();
|
return res.json();
|
||||||
}).then(function (data) {
|
}).then(function (data) {
|
||||||
return data.id;
|
if ('id' in data) {
|
||||||
|
return data.id;
|
||||||
|
} else {
|
||||||
|
// Refreshing the page to surface the request-error message
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onApprove: function (data, actions) {
|
onApprove: function (data, actions) {
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ class XHRView(View):
|
|||||||
}
|
}
|
||||||
|
|
||||||
paypal_order = prov._create_paypal_order(request, None, cart)
|
paypal_order = prov._create_paypal_order(request, None, cart)
|
||||||
r = JsonResponse(paypal_order.dict())
|
r = JsonResponse(paypal_order.dict() if paypal_order else {})
|
||||||
r._csp_ignore = True
|
r._csp_ignore = True
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user