1
0
mirror of git://f0xx.org/ac/ac-ms-graphs synced 2026-07-29 05:57:41 +03:00
Files
ac-ms-graphs/public/api/graphs.php
Anton Afanasyeu 224dc80d6d initial
2026-06-23 12:29:33 +02:00

23 lines
517 B
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/../../src/bootstrap.php';
Auth::check();
$days = (int) ($_GET['days'] ?? 14);
if ($days <= 0) {
$days = 14;
}
try {
$payload = GraphRepository::dashboardData($days);
json_out(['ok' => true, 'data' => $payload]);
} catch (Throwable $e) {
error_log('graphs api: ' . $e->getMessage());
$out = ['ok' => false, 'error' => 'graphs_load_failed'];
if (cfg('debug')) {
$out['hint'] = $e->getMessage();
}
json_out($out, 500);
}