MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / api

Function api

telemetry-dashboard/public/app.js:37–48  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

35/** Every fetch goes through here so an expired session lands on /login instead
36 * of failing silently mid-render. */
37export async function api(path) {
38 const response = await fetch(path, { headers: { accept: 'application/json' } });
39 if (response.status === 401) {
40 window.location.href = `/login?next=${encodeURIComponent(window.location.pathname)}`;
41 throw new Error('session expired');
42 }
43 if (!response.ok) {
44 const detail = await response.json().catch(() => null);
45 throw new Error(detail?.error ?? `responded ${response.status}`);
46 }
47 return response.json();
48}
49
50// ---------------------------------------------------------------------------
51// Days

Callers 2

refreshMetaFunction · 0.85
requestFunction · 0.85

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected