From a585bdaaff3022ffd71c162ce8a531bdd75d7414 Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Sun, 29 Sep 2024 10:07:04 +0300 Subject: [PATCH] Initial test with agents API calling --- app/pages/agents.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/pages/agents.php b/app/pages/agents.php index a05c962..2fb60d9 100644 --- a/app/pages/agents.php +++ b/app/pages/agents.php @@ -11,8 +11,17 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { // FIXME code here - header("Location: $app_root?platform=$platform_id&page=config"); - exit(); + $force = isset($_POST['force']) && $_POST['force'] == 'true'; + $result = fetchAgent($agent_id, $force); + + if ($result !== false) { + echo $result; // Return the API response as JSON + } else { + echo json_encode(['error' => 'Failed to fetch API data']); + } + +// header("Location: $app_root?platform=$platform_id&page=config"); +// exit(); // no form submitted, show the templates } else {