From d178a520534af7d1cbcc03134034ad8a2327b461 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 20 Mar 2023 17:14:16 +0700 Subject: product detail and cart header --- src/lib/product/components/Product.jsx | 37 ---------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 src/lib/product/components/Product.jsx (limited to 'src/lib/product/components/Product.jsx') diff --git a/src/lib/product/components/Product.jsx b/src/lib/product/components/Product.jsx deleted file mode 100644 index 9521cbe4..00000000 --- a/src/lib/product/components/Product.jsx +++ /dev/null @@ -1,37 +0,0 @@ -import { toast } from 'react-hot-toast' -import useWishlist from '@/lib/wishlist/hooks/useWishlist' -import createOrDeleteWishlistApi from '@/lib/wishlist/api/createOrDeleteWishlistApi' -import ProductDesktop from './ProductDesktop' -import useAuth from '@/core/hooks/useAuth' -import ProductMobile from './ProductMobile' -import { useRouter } from 'next/router' - -const Product = ({ product }) => { - const auth = useAuth() - const router = useRouter() - const { wishlist } = useWishlist({ productId: product?.id }) - - const toggleWishlist = async () => { - if (!auth) { - router.push('/login') - return - } - const data = { product_id: product.id } - await createOrDeleteWishlistApi({ data }) - if (wishlist?.data?.productTotal > 0) { - toast.success('Berhasil menghapus dari wishlist') - } else { - toast.success('Berhasil menambahkan ke wishlist') - } - wishlist.refetch() - } - - return ( - <> - - - - ) -} - -export default Product -- cgit v1.2.3