- 从 HMS 基座复制 apps/web/ (React + Ant Design + Vite + TypeScript) - 管理端自动代理 API 到 localhost:3000 (vite.config.ts) - 更新 scripts/dev.sh 支持三端启动: backend/admin/app - 登录验证通过, 用户管理/角色权限/审计日志等页面正常 - 添加 .gitignore 排除 node_modules/dist
31 lines
929 B
TypeScript
31 lines
929 B
TypeScript
import client from './client';
|
|
|
|
export interface SettingInfo {
|
|
id: string;
|
|
scope: string;
|
|
scope_id?: string;
|
|
setting_key: string;
|
|
setting_value: unknown;
|
|
version: number;
|
|
}
|
|
|
|
export async function getSetting(key: string, scope?: string, scopeId?: string) {
|
|
const { data } = await client.get<{ success: boolean; data: SettingInfo }>(
|
|
`/config/settings/${encodeURIComponent(key)}`,
|
|
{ params: { scope, scope_id: scopeId } },
|
|
);
|
|
return data.data;
|
|
}
|
|
|
|
export async function updateSetting(key: string, settingValue: unknown, version?: number) {
|
|
const { data } = await client.put<{ success: boolean; data: SettingInfo }>(
|
|
`/config/settings/${encodeURIComponent(key)}`,
|
|
{ setting_value: settingValue, version },
|
|
);
|
|
return data.data;
|
|
}
|
|
|
|
export async function deleteSetting(key: string, version: number) {
|
|
await client.delete(`/config/settings/${encodeURIComponent(key)}`, { data: { version } });
|
|
}
|