This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { EntityResponse, InventoryTreeNode, ListResponse, NodeContext } from '../types/inventory';
|
||||
import type { EntityResponse, InventoryTreeNode, ListResponse, NodeContext, Relation } from '../types/inventory';
|
||||
|
||||
async function handleResponse<T>(response: Response): Promise<T> {
|
||||
if (!response.ok) {
|
||||
@@ -21,3 +21,8 @@ export async function fetchNodeContext(id: string): Promise<NodeContext> {
|
||||
const data = await fetchJson<EntityResponse<NodeContext>>(`/inventory/nodes/${id}/context`);
|
||||
return data.item;
|
||||
}
|
||||
|
||||
export async function fetchNodeRelations(id: string): Promise<Relation[]> {
|
||||
const data = await fetchJson<ListResponse<Relation>>(`/inventory/nodes/${id}/relations`);
|
||||
return data.items;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user