Basic API consumption support and refactored UI to use material (#1)

Co-authored-by: Joe Arndt <jmarndt@users.noreply.github.com>
Reviewed-on: #1
This commit is contained in:
Joe 2026-02-23 21:16:31 +00:00
parent bd18fecdff
commit f2226b2bfd
34 changed files with 726 additions and 55 deletions

View file

@ -0,0 +1,24 @@
import { Injectable, signal } from '@angular/core';
import { HttpService } from './http.service';
@Injectable({
providedIn: 'root'
})
export class CategoryService {
private internalCategories = signal<Category[]>([]);
public readonly categories = this.internalCategories.asReadonly();
public readonly categoryPath = 'http://localhost:3000/common-cents/categories';
public constructor(private readonly http: HttpService) {
void this.fetchCategories();
}
public async fetchCategories(): Promise<void> {
this.internalCategories.set(await this.http.get<Category[]>(this.categoryPath));
}
}
export interface Category {
id: string;
name: string;
}