"use server";
import { GroupType } from "@/api/home";
import { server } from "@/utils/server";
import HomeTabs from "./_home/HomeTabs";

const TIME = 0;
const getGames = async () => {
    return server
        .request<GroupType[]>({
            url: "/v1/api/front/game_list",
            method: "POST",
            body: JSON.stringify({ template_key: "g_temp_9" }),
            next: { revalidate: TIME },
        })
        .then((res) => {
            if (res.code === 200) return res.data;
            return [];
        });
};

export default async function Page() {
    const group = await getGames();
    return (
        <>
            <HomeTabs tabs={group} />
        </>
    );
}
