-
-
- {!!e.mainImage ? (
+ {/*
*/}
+
+ {bag?.orderProducts?.map((e, index) => (
+
+
+
+ {!!e.mainImage ? (
+
+ ) : (
+
+
+ )}
+
+
+
+
+
+ {e?.productName}
+
+
+
+
+
+
+ {e?.hasDiscount ? (
+
) : (
-
-
-
-
-
- {e?.productName}
-
-
-
-
-
-
- {e?.hasDiscount ? (
-
- ) : (
-
- )}
-
-
- ))}
-
+
+ ))}
- ))}
+
{/* )} */}
diff --git a/src/app/categories/[...id]/page.jsx b/src/app/categories/[...id]/page.jsx
index 4c37816..3d8c6e9 100644
--- a/src/app/categories/[...id]/page.jsx
+++ b/src/app/categories/[...id]/page.jsx
@@ -3,10 +3,14 @@ import React from "react";
export async function generateMetadata({ params }) {
const decodedName = decodeURIComponent(params.id[1]);
+ const products = await fetchProducts(params?.["id"]?.[0]);
return {
title: decodedName,
- description: ` خرید ${decodedName}| برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه`,
+ description:
+ products.seo.description != ""
+ ? products.seo.description
+ : ` خرید ${decodedName}| برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه`,
metadataBase: new URL(
`https://www.vesmeh.com/categories/${params.id[0]}/${decodedName}`
),
@@ -22,13 +26,19 @@ export async function generateMetadata({ params }) {
},
openGraph: {
title: decodedName,
- description: ` خرید ${decodedName}| برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه`,
+ description:
+ products.seo.description != ""
+ ? products.seo.description
+ : ` خرید ${decodedName}| برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه`,
url: `https://www.vesmeh.com/categories/${params.id[0]}/${decodedName}`,
type: "website",
},
twitter: {
site: "@vesmehstore",
- description: ` خرید ${decodedName}| برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه`,
+ description:
+ products.seo.description != ""
+ ? products.seo.description
+ : ` خرید ${decodedName}| برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه`,
title: decodedName,
creator: "@vesmehstore",
},
@@ -42,7 +52,8 @@ export async function generateMetadata({ params }) {
// minPrice
// maxPrice
// sortBy
-const fetchProducts = async (categoryId, searchParams) => {
+
+const fetchProducts = async (categoryId, searchParams = {}) => {
const {
brandIds: brandIdsString,
isActive,
@@ -53,19 +64,23 @@ const fetchProducts = async (categoryId, searchParams) => {
const query = {
...(categoryId != 0 ? { categoryId } : {}),
page: 0,
- ...(!!isActive ? { isActive: !!isActive } : {}),
- ...(!!specialOffer ? { specialOffer: !!specialOffer } : {}),
+ ...(typeof isActive !== "undefined" ? { isActive: !!isActive } : {}),
+ ...(typeof specialOffer !== "undefined"
+ ? { specialOffer: !!specialOffer }
+ : {}),
...params,
};
const brandIds = brandIdsString?.split(",") ?? [];
const brandIdsQuery =
- brandIds?.length > 0 ? `&brandIds=${brandIds?.join("&brandIds=")}` : "";
+ brandIds.length > 0
+ ? `&${brandIds.map((id) => `brandIds=${id}`).join("&")}`
+ : "";
try {
const res = await fetch(
`${process.env.NEXT_PUBLIC_API_URL}/product?` +
- new URLSearchParams({ ...query }) +
+ new URLSearchParams(query).toString() +
brandIdsQuery,
{
cache: "no-cache",
@@ -74,9 +89,10 @@ const fetchProducts = async (categoryId, searchParams) => {
if (!res.ok) return [];
const products = await res.json();
- console.log("products++++++++++++++++++++++++++++++++", products);
+ console.log("Fetched products:", products);
return products;
} catch (error) {
+ console.error("Error fetching products:", error);
return [];
}
};
diff --git a/src/app/faq/page.jsx b/src/app/login/faq/page.jsx
similarity index 100%
rename from src/app/faq/page.jsx
rename to src/app/login/faq/page.jsx
diff --git a/src/app/profile/component/SideBarProfile/page.jsx b/src/app/profile/component/SideBarProfile/page.jsx
index d858f38..9cc2dbf 100644
--- a/src/app/profile/component/SideBarProfile/page.jsx
+++ b/src/app/profile/component/SideBarProfile/page.jsx
@@ -41,7 +41,7 @@ const SideBarProfile = () => {
- پیگیری سغارشات
+ پیگیری سفارشات