From 62efd1afc02422545579c529cd954d0c157889ee Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Sat, 18 Mar 2023 10:17:16 +0700
Subject: navbar user dropdown, add to cart

---
 src/lib/product/components/Product.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/lib/product/components/Product.jsx')

diff --git a/src/lib/product/components/Product.jsx b/src/lib/product/components/Product.jsx
index d1586ef9..9b41f5c3 100644
--- a/src/lib/product/components/Product.jsx
+++ b/src/lib/product/components/Product.jsx
@@ -18,10 +18,10 @@ const Product = ({ product }) => {
     }
     const data = { product_id: product.id }
     await createOrDeleteWishlistApi({ data })
-    if (wishlist.data.productTotal > 0) {
+    if (wishlist?.data?.productTotal > 0) {
       toast.success('Berhasil menghapus dari wishlist')
     } else {
-      toast.success('Berhasil menambahkan ke wishlist')
+      toast.error('Terjadi kesalahan internal, gagal menambahkan ke wishlist')
     }
     wishlist.refetch()
   }
-- 
cgit v1.2.3

