chore: add settings

This commit is contained in:
2026-03-07 19:31:54 +01:00
parent 91ad46c0f8
commit 4be03a067c
4 changed files with 360 additions and 0 deletions
+30
View File
@@ -656,3 +656,33 @@ export const deleteCategoryAdmin = async (
};
}
};
// ============================================
// PARAMÈTRES GLOBAUX
// ============================================
export interface AppSettings {
penalties_enabled: boolean;
points_categories: string[];
points_separated: boolean;
}
export const getSettings = async (): Promise<{ success: boolean; settings?: AppSettings; error?: string }> => {
try {
const { data } = await apiClient.get(`${V2}/admin/protected/settings`);
return { success: true, settings: data.settings };
} catch (error: any) {
return { success: false, error: error.response?.data?.error || "Erreur" };
}
};
export const updateSettings = async (
settings: AppSettings,
): Promise<{ success: boolean; settings?: AppSettings; error?: string }> => {
try {
const { data } = await apiClient.put(`${V2}/admin/protected/settings`, settings);
return { success: true, settings: data.settings };
} catch (error: any) {
return { success: false, error: error.response?.data?.error || "Erreur" };
}
};