chore: add color for category

This commit is contained in:
2026-03-07 15:48:27 +01:00
parent 8edc14ca55
commit 125d066dcb
5 changed files with 133 additions and 13 deletions
+5 -2
View File
@@ -590,6 +590,7 @@ const V1_PUBLIC = "https://uber-stup.club/api/v1";
export interface Category {
id: number;
name: string;
color: string;
created_at: string;
}
@@ -604,11 +605,12 @@ export const getCategories = async (): Promise<Category[]> => {
export const createCategoryAdmin = async (
name: string,
color: string,
): Promise<{ success: boolean; category?: Category; error?: string }> => {
try {
const { data } = await apiClient.post(
`${V2}/admin/protected/categories`,
{ name },
{ name, color },
);
return { success: true, category: data.category };
} catch (error: any) {
@@ -622,11 +624,12 @@ export const createCategoryAdmin = async (
export const updateCategoryAdmin = async (
id: number,
name: string,
color: string,
): Promise<{ success: boolean; category?: Category; error?: string }> => {
try {
const { data } = await apiClient.put(
`${V2}/admin/protected/categories/${id}`,
{ name },
{ name, color },
);
return { success: true, category: data.category };
} catch (error: any) {