fixed login session for user name, and updated the api calls on the product detials pages.
CI / test (push) Successful in 6s
CI / test (push) Successful in 6s
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user