Files
d8d-admin-mobile-starter-pu…/client/mobile/api/theme.ts
yourname 1df9f7fea2 创建了api目录并拆分为10个功能模块文件
建立了index.ts统一导出
精简了原api.ts文件
2025-05-13 09:00:58 +00:00

39 lines
951 B
TypeScript

import axios from 'axios';
import type {
ThemeSettings
} from '../../share/types.ts';
const API_BASE_URL = '/api';
// Theme API 定义
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;
}
}
};