13 lines
1.2 KiB
TypeScript
13 lines
1.2 KiB
TypeScript
|
|
import { api } from './http-client'
|
||
|
|
|
||
|
|
export interface AppConfigItem { id: string; key: string; value: string; description: string | null; environment: string; updatedAt: string }
|
||
|
|
export interface FeatureFlagItem { id: string; name: string; enabled: boolean; description: string | null; rolloutPct: number }
|
||
|
|
export interface ChangeLogItem { id: string; entityType: string; entityId: string; field: string; oldValue: string | null; newValue: string | null; changedBy: string | null; createdAt: string }
|
||
|
|
|
||
|
|
export function getConfig(): Promise<{ configs: AppConfigItem[]; flags: FeatureFlagItem[] }> { return api.get('/admin-api/config') }
|
||
|
|
export function setConfig(key: string, value: string): Promise<any> { return api.post('/admin-api/config', { key, value }) }
|
||
|
|
export function updateConfig(key: string, value: string): Promise<any> { return api.patch(`/admin-api/config/${key}`, { value }) }
|
||
|
|
export function deleteConfig(key: string): Promise<any> { return api.delete(`/admin-api/config/${key}`) }
|
||
|
|
export function toggleFlag(name: string, enabled: boolean): Promise<any> { return api.post(`/admin-api/config/flags/${name}`, { enabled }) }
|
||
|
|
export function getChangeLog(): Promise<ChangeLogItem[]> { return api.get('/admin-api/config/changelog') }
|