
'use client';

import { useAuth } from '@/components/auth/AuthContext';
import { LoadingScreen } from '@/components/auth/LoadingScreen';
import { redirect } from 'next/navigation';

export default function HomePage() {
  const { user, loading, isAuthenticated } = useAuth();

  // 如果正在加载，显示加载屏幕
  if (loading) {
    return <LoadingScreen />;
  }
  console.log('isAuthenticated:',isAuthenticated)
  // 如果未认证，重定向到登录页
  if (!isAuthenticated) {
    redirect('/login');
  }

  // 如果已认证，重定向到个人中心
  if (isAuthenticated) {
    redirect('/central-config/personal-center/personal-info');
  }

  // 兜底显示（一般不会执行到这里）
  return (
    <div></div>
  );
}