41 lines
995 B
PHP
41 lines
995 B
PHP
<?php
|
|
session_start();
|
|
|
|
$activePage = 'User';
|
|
$activeSubPage = 'Createuser';
|
|
include("../elements/functions.php");
|
|
|
|
|
|
|
|
|
|
//----------------------------API CALL--------------------//
|
|
$jsonFilePath = __DIR__ . '/../urls/api_endpoints.json';
|
|
$jsonData = file_get_contents($jsonFilePath);
|
|
$endpoints = json_decode($jsonData, true);
|
|
$url = $endpoints['create_user_api'];
|
|
//----------------------- ENDS HERE-------------------------//
|
|
|
|
|
|
if (!isset($_SESSION['token'])) {
|
|
include('token_exp.php');
|
|
}
|
|
|
|
$token = $_SESSION['token'];
|
|
$result = make_get_request($url, ["Authorization: $token"]);
|
|
$response = json_decode($result, true);
|
|
if (isset($response['items']) && is_array($response['items'])) {
|
|
$user_list = array_map(function($role) {
|
|
return [
|
|
'category_id' => $role['category_id'] ?? '-',
|
|
'name' => $role['name'] ?? '-'
|
|
];
|
|
}, $response['items']);
|
|
|
|
} else {
|
|
$user_list = "No users found or invalid response format.";
|
|
|
|
}
|
|
|
|
echo("test");
|
|
?>
|