feat: use data api for products
Node.js CI / Lint and Test (push) Successful in 1m35s

This commit is contained in:
2025-09-27 14:52:24 -07:00
parent bc2368866e
commit c8bd129c0f
5 changed files with 53 additions and 585 deletions
+34
View File
@@ -0,0 +1,34 @@
/**
* @copyright NHCarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { Injectable } from "@angular/core";
export type Product = Array<{
name: string;
description: string;
url: string | null;
wip: boolean;
category: "community" | "websites" | "apps";
premium: boolean;
avatar: string | null;
}>;
@Injectable({
providedIn: "root",
})
export class Products {
private products: Product = [];
public constructor() { }
public async getProducts(): Promise<Product> {
if (this.products.length > 0) {
return this.products;
}
const request = await fetch("https://data.nhcarrigan.com/projects.json");
const data = await request.json() as Product;
this.products = data;
return data;
}
}