Before 7 ヶ月 前
コミット
e9e6f0bdf1

+ 12 - 12
.env.local

@@ -1,16 +1,16 @@
+# 环境
 #baseurl
-NEXT_PUBLIC_BASE_URL=https://api.bcwin777.bet
+NEXT_PUBLIC_BASE_URL=http://192.168.0.84:8800
+#NEXT_PUBLIC_BASE_URL=http://192.168.0.67:8800
 #share link
-NEXT_PUBLIC_SHARE_URL=https://bcwin777.bet
+NEXT_PUBLIC_SHARE_URL=http://192.168.0.84:3000
 
 #firebase
-NEXT_PUBLIC_FIREBASE_APIKEY=AIzaSyCIE8xtySsYztsSgmQJx_aqPrrpHEuvgvw
-NEXT_PUBLIC_FIREBASE_AUTHDOMAIN=bcwin777-1bdda.firebaseapp.com
-NEXT_PUBLIC_FIREBASE_PROJECTID=bcwin777-1bdda
-NEXT_PUBLIC_FIREBASE_STORAGEBUCKET=bcwin777-1bdda.firebasestorage.app
-NEXT_PUBLIC_FIREBASE_MESSAGINGSENDERID=542456379513
-NEXT_PUBLIC_FIREBASE_APPID=1:542456379513:web:851a46fc639085170bfca8
-NEXT_PUBLIC_FIREBASE_MEASUREMENTID=G-GV6Y8DXHHD
-NEXT_PUBLIC_FIREBASE_KEYS=BOCfpA08vK6uxhMdRblnx9gPVBLx9WpTn9AutVNhHQQpVtXzDIKW0X6cmsNRaFDhyFDJfMqWjqC7mq6uDFIKU_M
-
-
+NEXT_PUBLIC_FIREBASE_APIKEY=AIzaSyDAWORGKhdyzb5KeqTi535VmD5gN2Cdle8
+NEXT_PUBLIC_FIREBASE_AUTHDOMAIN=bcwin-a99b1.firebaseapp.com
+NEXT_PUBLIC_FIREBASE_PROJECTID=bcwin-a99b1
+NEXT_PUBLIC_FIREBASE_STORAGEBUCKET=bcwin-a99b1.appspot.com
+NEXT_PUBLIC_FIREBASE_MESSAGINGSENDERID=1055413612814
+NEXT_PUBLIC_FIREBASE_APPID=1:1055413612814:web:7a563237de8e43849d275f
+NEXT_PUBLIC_FIREBASE_MEASUREMENTID=G-467M2BYJMS
+NEXT_PUBLIC_FIREBASE_KEYS=BAOsT7kii-ctLzGrgXe_wYhfuxlme1v4njnD0uPSKp3DpSnrUa2e709b9dRaeYVU7jF_qIx1y9tEv0CvilDCdnM

+ 5 - 0
next.config.mjs

@@ -13,6 +13,11 @@ const nextConfig = {
     sassOptions: {
         prependData: `@import "./src/styles/variables.scss";`,
     },
+    logging: {
+        fetches: {
+            fullUrl: true,
+        },
+    },
     images: {
         domains: ["9f.com", "images.hibigwin.com", "192.168.0.237"],
         remotePatterns: [

+ 3 - 28
src/app/[locale]/(TabBar)/profile/component/ModalCom/index.tsx

@@ -1,12 +1,7 @@
 "use client";
-import { getLogoutApi } from "@/api/user";
+import { useLogout } from "@/hooks/useLogout";
 import { useRouter } from "@/i18n/routing";
-import { useSearchStore } from "@/stores/useSearchStore";
-import { useUserInfoStore } from "@/stores/useUserInfoStore";
-import { useWalletStore } from "@/stores/useWalletStore";
 import { CenterPopup } from "antd-mobile";
-import dayjs from "dayjs";
-import Cookies from "js-cookie";
 import { useTranslations } from "next-intl";
 import { FC, PropsWithChildren, useEffect, useRef, useState } from "react";
 import "./style.scss";
@@ -21,29 +16,9 @@ export interface ItemComProps {
 
 const ModalCom: FC<PropsWithChildren<ItemComProps>> = () => {
     const t = useTranslations("ProfilePage");
-    const restGlobal = useUserInfoStore((state) => state.reset);
-    const resetSearch = useSearchStore((state) => state.reset);
-    const restWalletStore = useWalletStore((state) => state.reset);
-
-    // const { isOpen, onOpen, onClose, onOpenChange } = useDisclosure();
+    const { logout } = useLogout();
     const [visible, setVisible] = useState(false);
     const element = useRef<HTMLElement | null>(null);
-    const logoutRequest = async () => {
-        let res = await getLogoutApi();
-        const isClearPromotion = dayjs().isSame(sessionStorage.getItem("isClosePromotion"), "days");
-        if (res.code == 200) {
-            restGlobal();
-            resetSearch();
-            restWalletStore();
-            localStorage.clear();
-            Cookies.remove("Token");
-            router.replace("/login");
-        }
-        if (!isClearPromotion) {
-            sessionStorage.clear();
-        }
-    };
-
     const router = useRouter();
     const goPage = (path = "/") => {
         router.push(path);
@@ -80,7 +55,7 @@ const ModalCom: FC<PropsWithChildren<ItemComProps>> = () => {
                         <span className="modal-span-box" onClick={() => setVisible(false)}>
                             {t("Cancelar")}
                         </span>
-                        <span className="modal-span-box active" onClick={logoutRequest}>
+                        <span className="modal-span-box active" onClick={logout}>
                             {t("Continuar")}
                         </span>
                     </div>

+ 6 - 0
src/app/[locale]/(TabBar)/profile/page.tsx

@@ -11,6 +11,7 @@ const getUserInfo = async () => {
         .request<UserInfoRep>({
             url: "/v1/api/user/user_info",
             method: "POST",
+            next: { revalidate: 0 },
         })
         .then((res) => {
             if (res.code === 200) return res.data;
@@ -26,15 +27,20 @@ const getVipApi = async () => {
         .request<UserVipInfo>({
             url: "/v1/api/user/user_vip_info",
             method: "POST",
+            cache: "no-cache",
         })
         .then((res) => {
             if (res.code === 200) return res.data;
         });
 };
+
+export const dynamic = "force-dynamic";
+export const revalidate = 0;
 const Profile = async () => {
     const userInfo = await getUserInfo();
     const userMoney = await getMoneyApi();
     const userVip = await getVipApi();
+    console.log(`🚀🚀🚀🚀🚀-> in page.tsx on 40`, userVip);
     return (
         <div className="profile-box">
             <ProfileHeader userInfo={userInfo} userMoney={userMoney} userVip={userVip!} />

+ 1 - 0
src/components/Footer/index.tsx

@@ -123,6 +123,7 @@ const Footer: FC = () => {
                     {tabList.map((item, index) => {
                         return (
                             <Link
+                                prefetch={null}
                                 href={item.path}
                                 onClick={(event) => goPage(event, item.path)}
                                 key={index}

+ 10 - 0
src/hooks/actions.ts

@@ -0,0 +1,10 @@
+"use server";
+import { getLocale } from "next-intl/server";
+import { revalidatePath } from "next/cache";
+
+export const logoutAction = async () => {
+    const local = await getLocale();
+    console.log(`🚀🚀🚀🚀🚀-> in actions.ts on 7`, local);
+    revalidatePath(`/${local}/profile`, "page");
+    return;
+};

+ 8 - 1
src/utils/server/index.ts

@@ -25,7 +25,7 @@ const responseInterceptor = <T = any, R = unknown>(
                 resolve(response);
                 break;
             case 401:
-                console.log(`🚀🚀🚀🚀🚀->server-code: 401`, options.url);
+                console.log(`🚀🚀🚀🚀🚀->server-code: 401`, options);
                 redirect({ href: "/login", locale: "en" });
                 break;
             case 500:
@@ -52,6 +52,13 @@ class Server {
         options = requestInterceptor(options);
         const { method = "GET", url, headers = {}, data = {}, body, ...other } = options;
         const params = JSON.stringify(data);
+        console.log(`🚀🚀🚀🚀🚀-> in index.ts on 55`, {
+            Token: cookies().get("Token")?.value || "",
+            "Content-Type": "application/json",
+            language: cookies().get("language")?.value || cookies().get("NEXT_LOCALE")?.value,
+            url: url,
+            ...headers,
+        });
         try {
             const response = await fetch(`${this.BASE_URL}${url}`, {
                 method: method,