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:
+10
-4
@@ -58,9 +58,12 @@ export async function fetchProducts(params: {
|
||||
|
||||
if (sort) sp.set("sort", sort);
|
||||
|
||||
const url = `${API_BASE_URL}/api/v1/products?${sp.toString()}`;
|
||||
const url = `/api/catalog/products?${sp.toString()}`;
|
||||
|
||||
const res = await fetch(url, { cache: "no-store" });
|
||||
const res = await fetch(url, {
|
||||
cache: "no-store",
|
||||
credentials: 'include',
|
||||
});
|
||||
if (!res.ok) throw new Error(`Failed to load products (${res.status})`);
|
||||
const data = (await res.json()) as ProductListItem[];
|
||||
|
||||
@@ -83,10 +86,13 @@ export async function fetchProductById(params: {
|
||||
const { id, platform } = params;
|
||||
|
||||
const url =
|
||||
`${API_BASE_URL}/api/v1/products/${encodeURIComponent(id)}` +
|
||||
`/api/catalog/products/${encodeURIComponent(id)}` +
|
||||
(platform ? `?${new URLSearchParams({ platform })}` : "");
|
||||
|
||||
const res = await fetch(url, { cache: "no-store" });
|
||||
const res = await fetch(url, {
|
||||
cache: "no-store",
|
||||
credentials: 'include',
|
||||
});
|
||||
if (!res.ok) throw new Error(`Failed to load product (${res.status})`);
|
||||
return (await res.json()) as ProductDetail;
|
||||
}
|
||||
Reference in New Issue
Block a user