mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-17 04:56:40 +07:00
feat: add category management page (create/edit/delete)
The backend already had full category CRUD but nothing in the UI exposed it — categories could only be viewed inside charts. Adds a Categories nav item and page with icon/color pickers, grouped by expense/income, backed by new create/update/delete mutations. Also expands icons.tsx's ICON_MAP, which was missing 14 icon keys already in use by real category data and silently falling back to a wallet glyph everywhere they render. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,18 @@
|
||||
import { api } from "@/api/client";
|
||||
import type { Category } from "@/types";
|
||||
import type { Category, CategoryInput, CategoryUpdateInput } from "@/types";
|
||||
|
||||
export function fetchCategories() {
|
||||
return api.get<Category[]>("/categories");
|
||||
}
|
||||
|
||||
export function createCategory(input: CategoryInput) {
|
||||
return api.post<Category>("/categories", input);
|
||||
}
|
||||
|
||||
export function updateCategory(id: number, input: CategoryUpdateInput) {
|
||||
return api.patch<Category>(`/categories/${id}`, input);
|
||||
}
|
||||
|
||||
export function deleteCategory(id: number) {
|
||||
return api.delete<void>(`/categories/${id}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user