diff --git a/frontend/src/lib/inventoryApi.ts b/frontend/src/lib/inventoryApi.ts index 555203f..ed4bc74 100644 --- a/frontend/src/lib/inventoryApi.ts +++ b/frontend/src/lib/inventoryApi.ts @@ -1,14 +1,13 @@ +import { apiFetch } from './api'; import type { EntityResponse, InventoryTreeNode, ListResponse, NodeContext, Relation } from '../types/inventory'; async function handleResponse(response: Response): Promise { - if (!response.ok) { - throw new Error(`API error: ${response.status}`); - } + if (!response.ok) throw new Error(`API error: ${response.status}`); return response.json() as Promise; } -async function fetchJson(url: string): Promise { - const response = await fetch(url, { cache: 'no-store' }); +async function fetchJson(path: string): Promise { + const response = await apiFetch(path, { cache: 'no-store' }); return handleResponse(response); }