MCPcopy Create free account
hub / github.com/QuantiaAI/helm-agents / authRequest

Function authRequest

apps/web/src/api/client.ts:104–123  ·  view source on GitHub ↗
(path: string, body?: unknown)

Source from the content-addressed store, hash-verified

102 * Bearer header or trigger refresh-retry — these endpoints establish the session.
103 */
104export async function authRequest<T>(path: string, body?: unknown): Promise<T> {
105 const res = await fetch(apiUrl(path), {
106 method: "POST",
107 credentials: "include",
108 headers: { "Content-Type": "application/json" },
109 body: body === undefined ? undefined : JSON.stringify(body),
110 });
111 const text = await res.text();
112 const parsed = text ? JSON.parse(text) : undefined;
113 if (!res.ok) {
114 const message =
115 (parsed &&
116 typeof parsed === "object" &&
117 "error" in parsed &&
118 parsed.error) ||
119 `HTTP ${res.status}`;
120 throw new Error(String(message));
121 }
122 return parsed as T;
123}
124
125/** Fetch raw text (used for the docs markdown endpoint). Returns null on 404. */
126export async function apiGetText(path: string): Promise<string | null> {

Callers 2

logoutFunction · 0.90

Calls 1

apiUrlFunction · 0.85

Tested by

no test coverage detected