diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-03-02 16:51:05 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-03-02 16:51:05 +0700 |
| commit | d336735a91133cc3f1cf6f67ba2ac29f0985fd2e (patch) | |
| tree | f64a5c6de6e0ea015952ae028dca115077cffa45 /src2/pages/my/wishlist.js | |
| parent | 074edfe4e51efd3b4a44dc7fe6e1284c9c560501 (diff) | |
delete src2
Diffstat (limited to 'src2/pages/my/wishlist.js')
| -rw-r--r-- | src2/pages/my/wishlist.js | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/src2/pages/my/wishlist.js b/src2/pages/my/wishlist.js deleted file mode 100644 index 3d479802..00000000 --- a/src2/pages/my/wishlist.js +++ /dev/null @@ -1,60 +0,0 @@ -import WithAuth from "@/components/auth/WithAuth"; -import Alert from "@/components/elements/Alert"; -import Pagination from "@/components/elements/Pagination"; -import Spinner from "@/components/elements/Spinner"; -import AppBar from "@/components/layouts/AppBar"; -import Layout from "@/components/layouts/Layout"; -import ProductCard from "@/components/products/ProductCard"; -import apiOdoo from "@/core/utils/apiOdoo"; -import { useAuth } from "@/core/utils/auth"; -import { useRouter } from "next/router"; -import { useEffect, useState } from "react"; - -export default function Wishlist() { - const [ auth ] = useAuth(); - const router = useRouter(); - const { page = 1 } = router.query; - const [ wishlists, setWishlists ] = useState(null); - const [ pageCount, setPageCount ] = useState(0); - - useEffect(() => { - const loadWishlist = async () => { - const limit = 10; - const offset = (page - 1) * limit; - if (auth) { - const dataWishlist = await apiOdoo('GET', `/api/v1/user/${auth.id}/wishlist?limit=${limit}&offset=${offset}`); - setWishlists(dataWishlist); - setPageCount(Math.ceil(dataWishlist.product_total / limit)); - } - } - loadWishlist(); - }, [ auth, page ]); - - return ( - <WithAuth> - <Layout> - <AppBar title='Wishlist' /> - - <div className="px-4 py-6"> - { !wishlists && ( - <Spinner className="w-6 h-6 text-gray-600 fill-gray-900 mx-auto" /> - ) } - { wishlists?.products?.length == 0 && ( - <Alert type='info' className='text-center'> - Wishlist anda masih kosong - </Alert> - ) } - <div className="grid grid-cols-2 gap-3"> - {wishlists?.products.map((product) => ( - <ProductCard key={product.id} data={product} /> - ))} - </div> - - <div className="mt-6"> - <Pagination currentPage={page} pageCount={pageCount} url={`/my/wishlist`} /> - </div> - </div> - </Layout> - </WithAuth> - ) -}
\ No newline at end of file |
