MCPcopy
hub / github.com/7836246/cursor2api / apiFetch

Function apiFetch

vue-ui/src/api.ts:10–19  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

8}
9
10async function apiFetch<T>(path: string): Promise<T> {
11 const res = await fetch(path, { headers: getAuthHeader() });
12 if (res.status === 401) {
13 const pinia = getActivePinia();
14 if (pinia) useAuthStore(pinia).logout();
15 throw new Error('HTTP 401');
16 }
17 if (!res.ok) throw new Error(`HTTP ${res.status}`);
18 return res.json() as Promise<T>;
19}
20
21export function fetchLogs(params?: { requestId?: string; since?: number }): Promise<LogEntry[]> {
22 const q = new URLSearchParams();

Callers 6

fetchLogsFunction · 0.85
fetchRequestsFunction · 0.85
fetchStatsFunction · 0.85
fetchPayloadFunction · 0.85
fetchConfigFunction · 0.85
fetchMoreRequestsFunction · 0.85

Calls 2

getAuthHeaderFunction · 0.85
jsonMethod · 0.45

Tested by

no test coverage detected