fix(api): add fetchObjects export for InventoryView and TopologyView compatibility

This commit is contained in:
2026-08-06 16:35:31 +00:00
parent 6594d27670
commit 472cc601a6
+6 -1
View File
@@ -1,5 +1,5 @@
import { getToken, clearSession } from './session'; import { getToken, clearSession } from './session';
import type { ServiceInfo } from '../types'; import type { NetObject, ServiceInfo } from '../types';
const BACKEND = '/backend'; const BACKEND = '/backend';
const AGENT = '/api'; const AGENT = '/api';
@@ -45,6 +45,11 @@ export async function apiDelete(path: string): Promise<void> {
if (!res.ok) throw new Error(`DELETE ${path} failed: ${res.status}`); if (!res.ok) throw new Error(`DELETE ${path} failed: ${res.status}`);
} }
// Inventory objects - authenticated via apiGet
export async function fetchObjects(): Promise<NetObject[]> {
return apiGet<NetObject[]>('/objects');
}
// Legacy agent calls (unauthenticated local agent) // Legacy agent calls (unauthenticated local agent)
export async function fetchServices(): Promise<ServiceInfo[]> { export async function fetchServices(): Promise<ServiceInfo[]> {
const res = await fetch(`${AGENT}/services`); const res = await fetch(`${AGENT}/services`);