import { BannerRep } from "@/api/home";
import { server } from "@/utils/server";
import HomeCard from "../_home/HomeCard";
const getActivities = async () => {
    return server
        .request<BannerRep[]>({
            url: "/v1/api/front/activity_home",
            method: "POST",
            body: JSON.stringify({}),
            next: { revalidate: 0 },
        })
        .then((res) => {
            if (res.code === 200) {
                return res.data;
            } else {
                return [];
            }
        });
};

const Page = async () => {
    const activities = await getActivities();
    if (!activities.length) return null;
    return <HomeCard banners={activities}></HomeCard>;
};

export default Page;
