From 0d9468eedfeae84a0085eaa4ce9bfd07774f3536 Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 6 Aug 2026 16:39:57 +0000 Subject: [PATCH] fix(auth): inventoryApi - use apiFetch with /backend prefix and Authorization header --- frontend/src/lib/inventoryApi.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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); }