Refactor network API calls to use centralized authentication context and improve cache handling

- Removed redundant getApiToken function and replaced its usage with getAuthContext in network-api.js, network-events.js, and network-init.js.
- Updated cache handling in network-events.js and network-init.js to use CACHE_KEYS constants for better maintainability.
- Introduced cache.js for centralized cache management functions and constants, including cache initialization and retrieval.
- Added app-init.js for application lifecycle management, including cache orchestration and initialization checks.
- Created app_config.php to securely fetch API token and GraphQL port from configuration.
- Improved error handling and logging throughout the codebase for better debugging and maintenance.
This commit is contained in:
Jokob @NetAlertX
2026-02-26 04:21:29 +00:00
parent 00042ab594
commit 63cef590d6
12 changed files with 915 additions and 682 deletions

View File

@@ -526,13 +526,7 @@
function getVisibleDevicesList()
{
// Read cache (skip cookie expiry check)
devicesList = getCache('devicesListAll_JSON', true);
if (devicesList != '') {
devicesList = JSON.parse (devicesList);
} else {
devicesList = [];
}
devicesList = parseDeviceCache(getCache('devicesListAll_JSON', true));
// only loop thru the filtered down list
visibleDevices = getCache("ntx_visible_macs")