|
@@ -3,6 +3,7 @@ import { GameListRep, getGameDetailApi } from "@/api/home";
|
|
|
import { useRouter } from "@/i18n";
|
|
|
import { useGlobalStore } from "@/stores";
|
|
|
import { Button, Modal, ModalBody, ModalContent, useDisclosure } from "@nextui-org/react";
|
|
|
+import { Toast } from "antd-mobile";
|
|
|
import { useTranslations } from "next-intl";
|
|
|
import { FC, PropsWithChildren, ReactNode, useRef } from "react";
|
|
|
import styles from "./style.module.scss";
|
|
@@ -21,20 +22,24 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
const router = useRouter();
|
|
|
|
|
|
const handler = (game: GameListRep) => {
|
|
|
+ const { token } = state;
|
|
|
onOpen();
|
|
|
+ if (!token) {
|
|
|
+ router.push("/login?redirect=/withdraw");
|
|
|
+ return;
|
|
|
+ }
|
|
|
const params = {
|
|
|
id: game.id,
|
|
|
};
|
|
|
getGameDetailApi(params).then((res) => {
|
|
|
- urlRef.current = res.data.game_url;
|
|
|
+ urlRef.current = res.data?.game_url;
|
|
|
});
|
|
|
};
|
|
|
const playGameHandler = () => {
|
|
|
- const { token } = state;
|
|
|
- if (token) {
|
|
|
+ if (urlRef.current) {
|
|
|
window.open(urlRef.current);
|
|
|
} else {
|
|
|
- router.push("/login");
|
|
|
+ Toast.show("数据错误");
|
|
|
}
|
|
|
};
|
|
|
return (
|