Skip to content

Commit eb399ec

Browse files
committed
BE: Clean up whitespace in call_api function
1 parent 70645e7 commit eb399ec

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

front/index.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,20 @@ function is_https_request(): bool {
8787
function call_api(string $endpoint, array $data = []): ?array {
8888
/*
8989
Call NetAlertX API endpoint (for login page endpoints that don't require auth).
90-
90+
9191
Returns: JSON response as array, or null on failure
9292
*/
9393
try {
9494
// Determine API host (assume localhost on same port as frontend)
9595
$api_host = $_SERVER['HTTP_HOST'] ?? 'localhost';
9696
$api_scheme = is_https_request() ? 'https' : 'http';
9797
$api_url = $api_scheme . '://' . $api_host;
98-
98+
9999
$url = $api_url . $endpoint;
100-
100+
101101
$ch = curl_init($url);
102102
if (!$ch) return null;
103-
103+
104104
curl_setopt_array($ch, [
105105
CURLOPT_RETURNTRANSFER => true,
106106
CURLOPT_TIMEOUT => 5,
@@ -110,20 +110,20 @@ function call_api(string $endpoint, array $data = []): ?array {
110110
'Accept: application/json'
111111
]
112112
]);
113-
113+
114114
if (!empty($data)) {
115115
curl_setopt($ch, CURLOPT_POST, true);
116116
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
117117
}
118-
118+
119119
$response = curl_exec($ch);
120120
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
121121
curl_close($ch);
122-
122+
123123
if ($httpcode !== 200 || !$response) {
124124
return null;
125125
}
126-
126+
127127
return json_decode($response, true);
128128
} catch (Exception $e) {
129129
return null;

0 commit comments

Comments
 (0)