Tpl::display_ajax_return(): provided messages & errors event if is not a success return

This commit is contained in:
Benjamin Renard 2024-12-12 19:05:03 +01:00
parent 8815decc02
commit 38f66c9971
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -671,7 +671,7 @@ class Tpl {
) )
http_response_code($error_code ? $error_code : 400); http_response_code($error_code ? $error_code : 400);
if (($data['success'] ?? false) && !$keep_messages_on_success) { if (!$keep_messages_on_success) {
$data['messages'] = self :: get_messages(); $data['messages'] = self :: get_messages();
if (!$data['messages']) unset($data['messages']); if (!$data['messages']) unset($data['messages']);
self :: purge_messages(); self :: purge_messages();