import React from 'react'; import { AuthProvider } from '../hooks/AuthProvider'; import { LoginPage } from './LoginPage'; type AuthManagementProps = { children?: React.ReactNode; /** * 自定义登录页面组件 * 如果未提供,将使用默认的LoginPage */ customLoginPage?: React.ComponentType; /** * 登录成功后重定向的路径 * 默认为 '/admin/dashboard' */ redirectPath?: string; }; /** * 认证管理主组件 * 提供完整的认证管理功能,包括登录页面和认证状态管理 */ export const AuthManagement: React.FC = ({ children, customLoginPage: CustomLoginPage, redirectPath = '/admin/dashboard' }) => { // redirectPath is available for future use if needed console.log('Redirect path:', redirectPath); // Use redirectPath to avoid unused warning return ( {children ? ( children ) : ( CustomLoginPage ? ( ) : ( ) )} ); };