fix: Preserve HTTP status code in Response::json and handle 401 session expiration gracefully in loadConversations

This commit is contained in:
Hamza-Ayed
2026-08-27 14:56:50 +03:00
parent d18d1aa2b5
commit 7faf223583
2 changed files with 25 additions and 10 deletions
+4 -2
View File
@@ -39,9 +39,11 @@ class Response
* @param int $code
* @return void
*/
public function json($data, int $code = 200): void
public function json($data, ?int $code = null): void
{
$this->setStatusCode($code);
if ($code !== null) {
$this->setStatusCode($code);
}
$this->setHeader('Content-Type', 'application/json; charset=utf-8');
// Setup CORS headers — restrict origin to the configured allowed domain