Pārlūkot izejas kodu

fix: 更新401后数据清除问题

Before 10 mēneši atpakaļ
vecāks
revīzija
9ad34b45d7

+ 1 - 3
src/app/[locale]/(TabBar)/(ordinary)/profile/ProfileHeader.tsx

@@ -84,9 +84,7 @@ export const ProfileHeader = (props: Props) => {
                             </span>
                             <span>
                                 VIP
-                                {userVip.vip_next_level! + 1 >= 11
-                                    ? "MAX"
-                                    : userVip.vip_next_level! + 1}
+                                {userVip.vip_next_level}
                             </span>
                         </div>
                     </div>

+ 5 - 0
src/utils/client/index.ts

@@ -1,7 +1,10 @@
+import { useGlobalStore } from "@/stores";
+import { useWalletStore } from "@/stores/useWalletStore";
 import actions from "@/utils/client/actions";
 import Request from "./axios";
 
 const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL;
+
 const server = new Request({
     timeout: 10 * 1000,
     baseURL: BASE_URL,
@@ -24,6 +27,8 @@ const server = new Request({
             switch (code) {
                 case 401:
                     localStorage.removeItem("globalStore");
+                    useWalletStore.getState().reset();
+                    useGlobalStore.getState().reset();
                     await actions();
                     break;
                 default: