Files
sproutclaw/.pi/agent/extensions/webui/frontend/src/api/base.ts
root cf5edd6394
Some checks failed
CI / build-check-test (push) Has been cancelled
feat(sproutclaw): modularize webui, extensions, and agent config layout
Restructure local extensions into per-feature directories, split WebUI
into backend modules with slash commands and systemd support, and track
prompts/skills under .pi/agent for portable Gitea deployment.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-10 16:57:08 +08:00

14 lines
420 B
TypeScript

const API_BASE = (import.meta.env.VITE_API_BASE ?? "").trim().replace(/\/$/, "");
/** Resolve an API path. Empty base keeps same-origin relative paths for web `dist/`. */
export function apiUrl(path: string): string {
if (!path.startsWith("/")) {
throw new Error(`API path must start with /: ${path}`);
}
return API_BASE ? `${API_BASE}${path}` : path;
}
export function getApiBase(): string {
return API_BASE;
}