ui using new v1 api for products
This commit is contained in:
@@ -38,10 +38,10 @@ async function fetchProductDetail(params: {
|
||||
|
||||
if (!id) throw new Error(`Invalid product URL slug: '${productSlug}' (could not parse id)`);
|
||||
|
||||
// ---- Preferred (if you add it): GET /api/products/{id}
|
||||
// ---- Preferred (if you add it): GET /api/v1/products/{id}
|
||||
// If it 404s, we fall back.
|
||||
try {
|
||||
const res = await fetch(`${API_BASE_URL}/api/products/${encodeURIComponent(id)}`, {
|
||||
const res = await fetch(`${API_BASE_URL}/api/v1/products/${encodeURIComponent(id)}`, {
|
||||
headers: { Accept: "application/json" },
|
||||
});
|
||||
|
||||
@@ -54,7 +54,7 @@ async function fetchProductDetail(params: {
|
||||
|
||||
// ---- Fallback: use list endpoint + find by id (works right now with your current API)
|
||||
const listRes = await fetch(
|
||||
`${API_BASE_URL}/api/products?platform=${encodeURIComponent(platform)}&partRoles=${encodeURIComponent(partRole)}`,
|
||||
`${API_BASE_URL}/api/v1/products?platform=${encodeURIComponent(platform)}&partRoles=${encodeURIComponent(partRole)}`,
|
||||
{ headers: { Accept: "application/json" } }
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user