diff --git a/api/test.php b/api/test.php index 792857b..035f788 100644 --- a/api/test.php +++ b/api/test.php @@ -27,12 +27,13 @@ // TODO: дописать реализацию API // pre($USER); require_once __DIR__ . '/../inc/lib/CAPI.class.php'; - $API = new CAPI(); + try { - $API->$method(); + $result = CAPI::$method(); } catch (Throwable $e) { echo CJson::create(['status' => 'fail', 'message' => 'Метод '.$method.' не найден']); die(); } + echo CJson::create($result); \ No newline at end of file diff --git a/inc/lib/CAPI.class.php b/inc/lib/CAPI.class.php index c93cd7a..e0ad469 100644 --- a/inc/lib/CAPI.class.php +++ b/inc/lib/CAPI.class.php @@ -1,7 +1,7 @@ 'ok', 'message' => 'test was completed :)']; } } \ No newline at end of file