Files
TRAILERTREKKER/api/data_get.php
T
2026-06-25 21:39:21 +00:00

24 lines
493 B
PHP

<?php
declare(strict_types=1);
require __DIR__ . '/_bootstrap.php';
require_login();
$dataFile = $config['DATA_FILE'];
$data = read_json_file($dataFile);
// If file is empty/uninitialized, return defaults
if (empty($data)) {
$data = [
'meta' => ['schema' => 1, 'updatedAt' => gmdate('c')],
'trips' => [],
'shopping' => [],
'preTripTodos' => [],
'preTripChecklist' => [],
'upgrades' => [],
'fixes' => [],
];
}
json_response(['ok' => true, 'data' => $data]);