| 12345678910111213141516171819202122232425 |
- const BASE_URL = import.meta.env.VITE_API_BASE_URL ?? 'http://127.0.0.1:8010';
- export interface FeatureFlags {
- enable_openclaw: boolean;
- enable_openclaw_client: boolean;
- enable_openclaw_web: boolean;
- openclaw_client_url: string;
- }
- export async function getFeatureFlags(): Promise<FeatureFlags> {
- try {
- const res = await fetch(`${BASE_URL}/api/auth/features`);
- if (!res.ok) throw new Error('fetch failed');
- const json = await res.json();
- const data = json.data ?? json;
- return {
- enable_openclaw: data.enable_openclaw ?? true,
- enable_openclaw_client: data.enable_openclaw_client ?? true,
- enable_openclaw_web: data.enable_openclaw_web ?? true,
- openclaw_client_url: data.openclaw_client_url ?? '',
- };
- } catch {
- return { enable_openclaw: true, enable_openclaw_client: true, enable_openclaw_web: true, openclaw_client_url: '' };
- }
- }
|