| 1234567891011121314151617181920212223242526272829303132333435363738 |
- 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;
- }
- }
- };
|