From 1ca9cd55e4851d19d0f8d4516cd4f6a0931e14ee Mon Sep 17 00:00:00 2001 From: Katia Ghezali Date: Sat, 18 Nov 2023 20:27:29 +0100 Subject: [PATCH] fix(single product page): fix getting data from firebase issue fix #31 --- package-lock.json | 2 +- .../ProductDetails/ProductDetails.jsx | 91 +++++++++---------- src/pages/singleproduct/[productId].jsx | 2 +- 3 files changed, 46 insertions(+), 49 deletions(-) diff --git a/package-lock.json b/package-lock.json index c3ff1f5..254c6d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16167,4 +16167,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/components/ProductDetails/ProductDetails.jsx b/src/components/ProductDetails/ProductDetails.jsx index 4f142bc..92a2273 100644 --- a/src/components/ProductDetails/ProductDetails.jsx +++ b/src/components/ProductDetails/ProductDetails.jsx @@ -133,12 +133,12 @@ const ProductDetails = ({ productId }) => {

- Condition: + Condition: {productData.condition}

- Category: + Category: {productData.category}

@@ -154,56 +154,53 @@ const ProductDetails = ({ productId }) => { {/* User Info */}
- {userData && user ? ( -
-
- user picture -
-
-
-

- {userData.name} {userData.username} -

-
-

- {userData.email} + {/* {userData && user ? ( */} +

+
+ user picture +
+
+
+

+ {userData?.name} {userData?.username} +

+
+

+ {userData?.email} +

+
+

+ {productData?.price}$

-
-

- {productData.price}$ -

-
-

- {productData.location.city},{" "} - {productData.location.country} -

+

+ {productData.location?.city},{" "} + {productData.location?.country} +

- ) : ( -
-

- Please log in to get in touch with the owner - of this product.{" "} - - Log in - -

-
- )} +
+ {/* ) : ( */} +
+

+ Please log in to get in touch with the owner of + this product.{" "} + + Log in + +

+
+ {/* )} */}
diff --git a/src/pages/singleproduct/[productId].jsx b/src/pages/singleproduct/[productId].jsx index cf88c89..352a7bf 100644 --- a/src/pages/singleproduct/[productId].jsx +++ b/src/pages/singleproduct/[productId].jsx @@ -16,7 +16,7 @@ function SingleProduct() { {productId && (
{/* This will be visible on screens larger than or equal to lg (large) */} - + {/* */}
)}