feat: 手机验证码调试

This commit is contained in:
zdl
2025-10-16 10:09:15 +08:00
parent 8ce9268e76
commit 7c166f7186
9 changed files with 212 additions and 108 deletions

View File

@@ -22,7 +22,7 @@ export const useAuth = () => {
// 认证提供者组件
export const AuthProvider = ({ children }) => {
const [user, setUser] = useState(null);
const [isLoading, setIsLoading] = useState(false); // ⚡ 改为 false不阻塞首屏渲染
const [isLoading, setIsLoading] = useState(true); // ⚡ 串行执行,阻塞渲染直到 Session 检查完成
const [isAuthenticated, setIsAuthenticated] = useState(false);
const navigate = useNavigate();
const toast = useToast();
@@ -66,8 +66,10 @@ export const AuthProvider = ({ children }) => {
// 网络错误或超时,设置为未登录状态
setUser(null);
setIsAuthenticated(false);
} finally {
// ⚡ Session 检查完成后,停止加载状态
setIsLoading(false);
}
// ⚡ 移除 finally 中的 setIsLoading(false),不再阻塞渲染
};
// ⚡ 初始化时检查Session - 并行执行,不阻塞页面渲染