headers api

This commit is contained in:
rsgrinko committed 2023-03-16 17:47:40 +03:00
1 parent 5c66b6e2a7
commit 446a40be5c
1 file changed
+9
+9
View File
@@ -59,6 +59,10 @@
public static function output($data): void
{
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Allow-Methods: *');
header('Access-Control-Allow-Headers: *');
echo json_encode(
[
'success' => true,
@@ -78,6 +82,11 @@
*/
public static function outputError (Throwable $exception): void
{
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Allow-Methods: *');
header('Access-Control-Allow-Headers: *');
echo json_encode(
[
'success' => false,