metadata-management #10
2 changed files with 10 additions and 1 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue