fixed login session for user name, and updated the api calls on the product detials pages.
CI / test (push) Successful in 6s

This commit is contained in:
2026-01-25 20:20:48 -05:00
parent 3aee0e6755
commit b09ccc542e
13 changed files with 256 additions and 21 deletions
+5 -2
View File
@@ -50,9 +50,12 @@ export default function PartsListPageClient(props: {
// Your current list endpoint:
// GET /api/v1/products?platform=AR-15&partRoles=upper-receiver
const url = `${API_BASE_URL}/api/v1/products?platform=${encodeURIComponent(platform)}&partRoles=${encodeURIComponent(partRole)}`;
const url = `/api/catalog/products?platform=${encodeURIComponent(platform)}&partRoles=${encodeURIComponent(partRole)}`;
const res = await fetch(url, { headers: { Accept: "application/json" } });
const res = await fetch(url, {
headers: { Accept: "application/json" },
credentials: 'include',
});
if (!res.ok) {
const txt = await res.text().catch(() => "");
throw new Error(`Failed to load products (${res.status}): ${txt}`);
+4 -3
View File
@@ -41,8 +41,9 @@ async function fetchProductDetail(params: {
// ---- 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/v1/products/${encodeURIComponent(id)}`, {
const res = await fetch(`/api/catalog/products/${encodeURIComponent(id)}`, {
headers: { Accept: "application/json" },
credentials: 'include',
});
if (res.ok) {
@@ -54,8 +55,8 @@ 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/v1/products?platform=${encodeURIComponent(platform)}&partRoles=${encodeURIComponent(partRole)}`,
{ headers: { Accept: "application/json" } }
`/api/catalog/products?platform=${encodeURIComponent(platform)}&partRoles=${encodeURIComponent(partRole)}`,
{ headers: { Accept: "application/json" }, credentials: 'include' }
);
if (!listRes.ok) {