Forráskód Böngészése

fix: 增加serviceWorker判断

Before 8 hónapja
szülő
commit
77f5dc241e

+ 4 - 2
src/app/[locale]/(TabBar)/sports/SportsClient.tsx

@@ -1,5 +1,6 @@
 "use client";
 import { GameInfo, GameRequest } from "@/api/home";
+import { useRouter } from "@/i18n/routing";
 import { server } from "@/utils/client";
 import { useTranslations } from "next-intl";
 import Script from "next/script";
@@ -13,6 +14,7 @@ interface Props {
 const SportsClient: FC<Props> = (props) => {
     const t = useTranslations("ProfilePage");
     const btRef = useRef(null);
+    const router = useRouter();
     const getGameDetailApi = async (data: GameRequest) => {
         return server
             .request<GameInfo>({
@@ -44,8 +46,8 @@ const SportsClient: FC<Props> = (props) => {
             betSlipOffsetBottom: 65,
             // betSlipOffsetRight: 750,
             betSlipZIndex: 0,
-            onRechage: function () {
-                console.log(`🚀🚀🚀🚀🚀-> in SportsClient.tsx on 33`, 1);
+            onRecharge: function () {
+                router.push("/deposit");
             },
             onRouteChange: function () {},
             onLogin: function () {},

+ 3 - 1
src/app/[locale]/providers.tsx

@@ -138,7 +138,9 @@ const Layout = ({ children, themeProps }: ProvidersProps) => {
 };
 export const Providers = ({ children, themeProps }: ProvidersProps) => {
     useDebounceEffect(() => {
-        initFirebase();
+        if ("serviceWorker" in navigator) {
+            initFirebase();
+        }
     }, []);
     return (
         <ConfigProvider locale={enUS}>