"use client";
import Navbar from "@comp/Navbar/page";
import Footer from "@comp/Footer/page";
import HeroSection from "@comp/LandingPage/HeroSection/page";
import SurpriseSection from "@comp/LandingPage/SurpriseSection/page";
import BetweenSexualSection from "@comp/LandingPage/BetweenSexualSection/page";
import BrandsLogoSection from "@comp/LandingPage/BrandsLogoSection/page";
import BeautySection from "@comp/LandingPage/BeautySection/page";
import HomeSection from "@comp/LandingPage/HomeSection/page";

async function getData() {
  const res = await fetch("http://192.168.88.12:32770/api/product/category");
  // The return value is *not* serialized
  // You can return Date, Map, Set, etc.

  if (!res.ok) {
    // This will activate the closest `error.js` Error Boundary
    throw new Error("Failed to fetch data");
  }

  return res.json();
}

export default async function Page() {
  const dataNav = await getData();

  return (
    <>
      <div className="bg-header">
        <Navbar theme={0} dataNav={dataNav} />

        <HeroSection />
      </div>
      <SurpriseSection />
      <BetweenSexualSection />
      <BrandsLogoSection />
      <BeautySection />
      <HomeSection />
      <Footer />
    </>
  );
}
