diff options
Diffstat (limited to 'src/pages/my/wishlist.js')
| -rw-r--r-- | src/pages/my/wishlist.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/pages/my/wishlist.js b/src/pages/my/wishlist.js new file mode 100644 index 00000000..175bfa08 --- /dev/null +++ b/src/pages/my/wishlist.js @@ -0,0 +1,38 @@ +import WithAuth from "@/components/auth/WithAuth"; +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 { useEffect, useState } from "react"; + +export default function Wishlist() { + const [ auth ] = useAuth(); + const [ wishlists, setWishlists ] = useState(null); + + useEffect(() => { + const loadWishlist = async () => { + if (auth) { + const dataWishlist = await apiOdoo('GET', `/api/v1/user/${auth.id}/wishlist`); + setWishlists(dataWishlist); + } + } + loadWishlist(); + }, [ auth ]); + + return ( + <WithAuth> + <Layout> + <AppBar title='Wishlist' /> + + <div className="px-4 py-6"> + <div className="grid grid-cols-2 gap-3"> + {wishlists?.products.map((product) => ( + <ProductCard key={product.id} data={product} /> + ))} + </div> + </div> + </Layout> + </WithAuth> + ) +}
\ No newline at end of file |
