year 1 місяць тому
батько
коміт
ab630c81ce

+ 1 - 0
src/app/[locale]/(TabBar)/[[...share]]/_home/HomeGames.tsx

@@ -46,6 +46,7 @@ const HomeGames = (props: Props) => {
     };
 
     const providers = React.useMemo(() => {
+        if (!groupGames?.length) return [] as any;
         const providersData = groupGames.filter((item) => item.type === 2);
         if (providersData.length === 0) return [] as any;
         return providersData[0];

+ 18 - 10
src/app/[locale]/(TabBar)/[[...share]]/page.tsx

@@ -1,24 +1,24 @@
-"use server";
+"use client";
 import { GroupType, PrizeTypes } from "@/api/home";
-import { server } from "@/utils/server";
-import dynamic from "next/dynamic";
+import { server } from "@/utils/client";
 import React from "react";
+import HomeTabs from "./_home/HomeTabs";
 
-const HomeTabs = dynamic(() => import("./_home/HomeTabs"));
+// const HomeTabs = () => import("./_home/HomeTabs");
 
 const TIME = 0;
-const getGames = React.cache(async () => {
+const getGames = async () => {
     return server
         .request<GroupType[]>({
             url: "/v1/api/front/game_list",
             method: "POST",
-            next: { revalidate: TIME },
+            // next: { revalidate: TIME },
         })
         .then((res) => {
             if (res.code === 200) return res.data;
             return [];
         });
-});
+};
 
 const getPrizeApi = () => {
     return server.request<PrizeTypes[]>({
@@ -27,11 +27,19 @@ const getPrizeApi = () => {
     });
 };
 
-export default async function Page(props: any) {
-    const group = await getGames();
-    console.log(group);
+export default function Page(props: any) {
+    const [group, setGroup] = React.useState<GroupType[]>([]);
 
+    React.useEffect(() => {
+        getData();
+    }, []);
+    const getData = async () => {
+        const groupData = await getGames();
+        setGroup(groupData);
+    };
+    //const group = await getGames();
     // const result = await getPrizeApi();
+    if (!group?.length) return null;
     return (
         <HomeTabs
             tabs={group}

+ 5 - 5
src/components/Card/Card.tsx

@@ -148,11 +148,11 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
         res = await toggleFavorite(params);
         if (res.code === 200) {
             setIsFavorite(!isFavorite);
-            Toast.show({
-                icon: "success",
-                content: isFavorite ? "Cancelar favoritos com sucesso" : "Sucesso na coleção",
-                maskClickable: false,
-            });
+            // Toast.show({
+            //     icon: "success",
+            //     content: isFavorite ? "Cancelar favoritos com sucesso" : "Sucesso na coleção",
+            //     maskClickable: false,
+            // });
         }
     };