完整API模块结构:

client/admin/api/ ├── auth.ts (认证API) ├── users.ts (用户API) ├── files.ts (文件API) ├── theme.ts (主题API) ├── charts.ts (图表API) ├── messages.ts (消息API) ├── sys.ts (系统API) ├── know_info.ts (知识库API) ├── maps.ts (地图API) └── index.ts (统一入口)
This commit is contained in:
yourname
2025-05-13 08:06:34 +00:00
parent bd72f60db8
commit 08ae3b85df
21 changed files with 818 additions and 907 deletions

38
client/admin/api/theme.ts Normal file
View File

@@ -0,0 +1,38 @@
import axios from 'axios';
import type { ThemeSettings } from '../../share/types.ts';
const API_BASE_URL = '/api';
export interface ThemeSettingsResponse {
message: string;
data: ThemeSettings;
}
export const ThemeAPI = {
getThemeSettings: async (): Promise<ThemeSettings> => {
try {
const response = await axios.get(`${API_BASE_URL}/theme`);
return response.data.data;
} catch (error) {
throw error;
}
},
updateThemeSettings: async (themeData: Partial<ThemeSettings>): Promise<ThemeSettings> => {
try {
const response = await axios.put(`${API_BASE_URL}/theme`, themeData);
return response.data.data;
} catch (error) {
throw error;
}
},
resetThemeSettings: async (): Promise<ThemeSettings> => {
try {
const response = await axios.post(`${API_BASE_URL}/theme/reset`);
return response.data.data;
} catch (error) {
throw error;
}
}
};