import { NoticeRep, PromotionRep } from "@/api/home";
import { server } from "@/utils/server";
import HomeMessage from "../_home/HomeMessage";
const getPromotions = async () => {
    return server
        .request<PromotionRep[], { summery: { showType: 1 | 2 } }>({
            url: "/v1/api/front/pop_list",
            method: "POST",
            next: { revalidate: 0 },
        })
        .then((res) => {
            if (res.code === 200) return res;
        });
};

const getNotices = async () => {
    return server
        .request<NoticeRep[]>({
            url: "/v1/api/front/notice_list",
            method: "post",
            next: { revalidate: 0 },
        })
        .then((res) => {
            if (res.code === 200) return res.data;
            return [];
        });
};
const Page = async () => {
    const promotions = await getPromotions();

    const notices = await getNotices();

    return (
        <>
            {/*站内信*/}
            <HomeMessage notices={notices} />
            {/* 站内弹窗广告  */}
            {/*<HomePromotion data={promotions?.data || []} type={promotions?.summery.showType || 1} />*/}
        </>
    );
};

export default Page;
