From 9e222e923028185f5a8d74768b04f99d396c0583 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 27 Jan 2023 17:09:50 +0700 Subject: wishlist and error page --- src/pages/_error.js | 11 +++++++++++ src/pages/my/transactions.js | 2 +- src/pages/my/wishlist.js | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 src/pages/_error.js create mode 100644 src/pages/my/wishlist.js (limited to 'src') diff --git a/src/pages/_error.js b/src/pages/_error.js new file mode 100644 index 00000000..107ddf46 --- /dev/null +++ b/src/pages/_error.js @@ -0,0 +1,11 @@ +import Header from "@/components/layouts/Header"; +import Layout from "@/components/layouts/Layout"; + +export default function Error() { + return ( + +
+ + + ); +} \ No newline at end of file diff --git a/src/pages/my/transactions.js b/src/pages/my/transactions.js index 24b6a1bc..85f0935f 100644 --- a/src/pages/my/transactions.js +++ b/src/pages/my/transactions.js @@ -100,7 +100,7 @@ export default function Transactions() {
Total Invoice -

{ transaction.invoice_count }

+

{ transaction.invoice_count } Invoice

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 ( + + + + +
+
+ {wishlists?.products.map((product) => ( + + ))} +
+
+
+
+ ) +} \ No newline at end of file -- cgit v1.2.3