MCPcopy Create free account
hub / github.com/MagicCube/agentara / apiFetch

Function apiFetch

web/src/lib/api/client.ts:11–26  ·  view source on GitHub ↗
(
  path: string,
  init?: RequestInit,
)

Source from the content-addressed store, hash-verified

9 * Typed fetch wrapper for the Agentara backend API.
10 */
11export async function apiFetch<T>(
12 path: string,
13 init?: RequestInit,
14): Promise<T> {
15 const res = await fetch(`${BASE_URL}${path}`, {
16 ...init,
17 headers: {
18 "Content-Type": "application/json",
19 ...init?.headers,
20 },
21 });
22 if (!res.ok) {
23 throw new Error(`API error ${res.status}: ${res.statusText}`);
24 }
25 return res.json() as Promise<T>;
26}

Callers 3

useScheduledTasksFunction · 0.90
useScheduledTaskDeleteFunction · 0.90
useScheduledTaskUpdateFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected