File size: 873 Bytes
21c7db9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function withoutTrailingSlash(value: string): string {
  return value.replace(/\/$/, "");
}

function defaultEnvBase(): string {
  if (typeof window === "undefined") return "http://127.0.0.1:8100";
  const host = window.location.hostname;
  const localHosts = new Set(["localhost", "127.0.0.1", "0.0.0.0"]);
  if (localHosts.has(host)) return "http://127.0.0.1:8100";
  return window.location.origin;
}

export const API_BASE = withoutTrailingSlash((import.meta.env.VITE_API_BASE as string | undefined) ?? "/api");
export const ENV_BASE = withoutTrailingSlash(
  (import.meta.env.VITE_ENV_BASE as string | undefined) ?? defaultEnvBase(),
);

export const PAGES = [
  "Home",
  "Dashboard",
  "PatientWorkbench",
  "EpisodeReplay",
  "PolicyCompare",
  "PrecisionDosing",
  "TrainingMonitor",
  "SafetyInspector",
] as const;

export type PageName = (typeof PAGES)[number];