修改用户授权调用位置和逻辑

This commit is contained in:
张成
2025-11-18 08:00:38 +08:00
parent 4568e758a7
commit 988f57aa5e
12 changed files with 343 additions and 81 deletions

View File

@@ -10,6 +10,7 @@ import * as LoginService from "@/services/loginService";
import { getCurrentLocation } from "@/utils/locationUtils";
import { useUserInfo, useUserActions } from "@/store/userStore";
import { useGlobalState } from "@/store/global";
import { waitForAuthInit } from "@/utils/authInit";
import { requireLoginWithPhone } from "@/utils/helper";
import GameTags from "./components/GameTags";
import Carousel from "./components/Carousel";
@@ -46,8 +47,14 @@ function Index() {
const commentRef = useRef();
useEffect(() => {
updateLocation();
fetchUserInfo();
const init = async () => {
updateLocation();
// 先等待静默登录完成
await waitForAuthInit();
// 然后再获取用户信息
await fetchUserInfo();
};
init();
}, []);
useDidShow(() => {