feat: 日志优化

This commit is contained in:
zdl
2025-10-18 17:33:15 +08:00
parent a7695c7365
commit 47fcb570c0
10 changed files with 80 additions and 24 deletions

View File

@@ -19,6 +19,7 @@ import { useAuth } from '../../contexts/AuthContext';
import { useNavigate } from 'react-router-dom';
import heroBg from '../../assets/img/BackgroundCard1.png';
import '../../styles/home-animations.css';
import { logger } from '../../utils/logger';
export default function HomePage() {
const { user, isAuthenticated } = useAuth(); // ⚡ 移除 isLoading不再依赖它
@@ -27,15 +28,12 @@ export default function HomePage() {
// 保留原有的调试信息
useEffect(() => {
console.log('🏠 HomePage AuthContext 状态:', {
user,
logger.debug('HomePage', 'AuthContext状态', {
userId: user?.id,
username: user?.username,
nickname: user?.nickname,
isAuthenticated,
hasUser: !!user,
userInfo: user ? {
id: user.id,
username: user.username,
nickname: user.nickname
} : null
hasUser: !!user
});
}, [user, isAuthenticated]);