Url::error_page(): fix handling API mode

This commit is contained in:
Benjamin Renard 2024-08-03 09:05:46 +02:00
parent 72abbb7371
commit 630e2c4d02
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -201,6 +201,14 @@ class Url {
http_response_code($error_code); http_response_code($error_code);
if (Tpl :: initialized()) { if (Tpl :: initialized()) {
if (self :: api_mode())
Tpl :: display_ajax_return(
[
"success" => false,
"error" => $error['message'],
],
$error_code
);
Tpl :: assign('message', $error['message']); Tpl :: assign('message', $error['message']);
Tpl :: display('error_page.tpl', $error['pagetitle']); Tpl :: display('error_page.tpl', $error['pagetitle']);
exit(); exit();