From 12217d642e162fe3364ce58b703197552931f713 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 6 Jan 2025 15:47:01 +0100 Subject: [PATCH] JS handle_ajax_return() helper: fix handling Tpl :: display_ajax_error() response type --- static/js/app.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/js/app.js b/static/js/app.js index 67f5486..5372ec6 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -176,6 +176,7 @@ function handle_ajax_return( "done" in data && "fail" in data && "always" in data ? data.responseJSON ?? {} : data; + if (data.error) alertify.notify(data.error, "error"); if (data.errors) $(data.errors).each(function (idx, error) { alertify.notify(error, "error"); @@ -191,7 +192,7 @@ function handle_ajax_return( alertify.notify(success_message, "success", 5); return true; } - if (!(data.errors && data.errors.length)) + if (!(data.errors && data.errors.length) && !data.error) alertify.notify( default_error ?? _(