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