26 lines
741 B
TypeScript
26 lines
741 B
TypeScript
export type HealthStatus = {
|
|
status: "ok";
|
|
deploymentMode?: "local_trusted" | "authenticated";
|
|
deploymentExposure?: "private" | "public";
|
|
authReady?: boolean;
|
|
bootstrapStatus?: "ready" | "bootstrap_pending";
|
|
bootstrapInviteActive?: boolean;
|
|
features?: {
|
|
companyDeletionEnabled?: 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();
|
|
},
|
|
};
|