full app is using live data now,
This commit is contained in:
@@ -9,11 +9,9 @@ import type { CategoryId, Part } from "@/types/gunbuilder";
|
||||
type ViewMode = "card" | "list";
|
||||
|
||||
type GunbuilderProductFromApi = {
|
||||
id: number;
|
||||
uuid: string;
|
||||
slug: string;
|
||||
id: string; // backend UUID as string
|
||||
name: string;
|
||||
brandName: string;
|
||||
brand: string; // backend brand field
|
||||
platform: string;
|
||||
partRole: string;
|
||||
price: number | null;
|
||||
@@ -79,13 +77,13 @@ export default function CategoryPage() {
|
||||
|
||||
const data: GunbuilderProductFromApi[] = await res.json();
|
||||
|
||||
// 🔑 Normalize into your Part type using *id* and *brand*
|
||||
const normalized: Part[] = data.map((p) => ({
|
||||
id: p.uuid,
|
||||
id: p.id, // ✅ backend id (UUID string)
|
||||
categoryId,
|
||||
name: p.name,
|
||||
brand: p.brandName,
|
||||
brand: p.brand, // ✅ backend brand
|
||||
price: p.price ?? 0,
|
||||
// these fields exist in the Part type even if you’re not using them yet
|
||||
imageUrl: p.mainImageUrl ?? undefined,
|
||||
url: p.buyUrl ?? undefined,
|
||||
notes: undefined,
|
||||
|
||||
Reference in New Issue
Block a user