mirror of
https://github.com/pretix/pretix.git
synced 2026-05-16 17:03:58 +00:00
improve error handling
This commit is contained in:
@@ -543,7 +543,10 @@ class CartExtendReservation(EventViewMixin, CartActionMixin, AsyncAction, View):
|
||||
known_errortypes = ['CartError']
|
||||
|
||||
def _ajax_response_data(self, value):
|
||||
return value or {}
|
||||
if isinstance(value, dict):
|
||||
return value
|
||||
else:
|
||||
return {}
|
||||
|
||||
def get_success_message(self, value):
|
||||
if value['success'] > 0:
|
||||
|
||||
@@ -41,7 +41,7 @@ function async_task_schedule_check(context, timeout) {
|
||||
|
||||
function async_task_on_success(data) {
|
||||
"use strict";
|
||||
if ((async_task_is_download || async_task_dont_redirect) && data.success) {
|
||||
if ((async_task_is_download && data.success) || async_task_dont_redirect) {
|
||||
waitingDialog.hide();
|
||||
if (location.href.indexOf("async_id") !== -1) {
|
||||
history.replaceState({}, "pretix", async_task_old_url);
|
||||
|
||||
@@ -101,8 +101,11 @@ $(function () {
|
||||
cart.init();
|
||||
}
|
||||
|
||||
$("#cart-extend-form").on("pretix:async-task-success", function(e, data, x, y, z) {
|
||||
cart.set_deadline(data.expiry, data.max_expiry_extend);
|
||||
$("#cart-extend-form").on("pretix:async-task-success", function(e, data) {
|
||||
if (data.success)
|
||||
cart.set_deadline(data.expiry, data.max_expiry_extend);
|
||||
else
|
||||
alert(data.message);
|
||||
});
|
||||
|
||||
$("#cart-extend-modal button").click(function() {
|
||||
|
||||
Reference in New Issue
Block a user