You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3 KiB

  1. import React from 'react'
  2. import Navbar from "@/components/_App/NavbarYamaha"
  3. import Footer from "@/components/_App/FooterYamaha"
  4. import PageBanner from '@/components/Common/PageBanner'
  5. import CartContent from '@/components/Yamaha/Shop/Cart'
  6. import GetproductCart from 'api/shop/cart';
  7. import Cookies from "cookies";
  8. const Cart = function ({ cart_product, backend, ...props }) {
  9. return (
  10. <>
  11. <Navbar />
  12. <PageBanner pageTitle="Cart" />
  13. <div className="cart-area ptb-80">
  14. <div className="container">
  15. <div className="row">
  16. <div className="col-lg-12 col-md-12">
  17. <CartContent cart_product={cart_product} backend={backend}/>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. <Footer />
  23. </>
  24. )
  25. }
  26. export default Cart;
  27. export async function getServerSideProps() {
  28. var cart_product = [];
  29. const backend = process.env.BACKEND_SERVER_URI;
  30. var res = await GetproductCart.GetCartProduct();
  31. if (res["STATUS"] === 1) {
  32. cart_product = res["DATA"]["carts"];
  33. }
  34. return {
  35. props: { cart_product, backend }, // will be passed to the page component as props
  36. };
  37. }