support for editing category

This commit is contained in:
Joe Arndt 2026-02-26 11:35:18 -06:00
parent 5c48a6f4e7
commit dbb4c1ed38
2 changed files with 10 additions and 1 deletions

View file

@ -18,6 +18,7 @@ export class CategoriesComponent {
public constructor(private readonly categoryService: CategoryService) { }
public async updateCategory(category: Category): Promise<void> {
console.log('updated category', category); // TODO: Remove
await this.categoryService.updateCategory(category);
await this.categoryService.fetchCategories();
}
}

View file

@ -16,9 +16,17 @@ export class CategoryService {
public async fetchCategories(): Promise<void> {
this.internalCategories.set(await this.http.get<Category[]>(this.categoryPath));
}
public async updateCategory(category: Category): Promise<Category> {
return await this.http.put<Category>(this.categoryPath, category);
}
}
export interface Category {
id: string;
name: string;
}
export interface CreateCategory {
name: string;
}