forked from LF-Decentralized-Trust-labs/gitmesh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhealth.ts
More file actions
24 lines (23 loc) · 706 Bytes
/
Copy pathhealth.ts
File metadata and controls
24 lines (23 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
export type HealthStatus = {
status: "ok";
deploymentMode?: "local_trusted" | "authenticated";
deploymentExposure?: "private" | "public";
authReady?: boolean;
bootstrapStatus?: "ready" | "bootstrap_pending";
features?: {
projectDeletionEnabled?: boolean;
};
};
export const healthApi = {
get: async (): Promise<HealthStatus> => {
const res = await fetch("/api/health", {
credentials: "include",
headers: { Accept: "application/json" },
});
if (!res.ok) {
const payload = await res.json().catch(() => null) as { error?: string } | null;
throw new Error(payload?.error ?? `Failed to load health (${res.status})`);
}
return res.json();
},
};