import { useSearchParams } from 'react-router-dom';
import { HomePage } from './HomePage';
import { SharePage } from './SharePage';

/** 有 ?token= 时走公开分享页，否则为需登录的首页 */
export function IndexPage() {
  const [params] = useSearchParams();
  const token = params.get('token')?.trim();
  if (token) return <SharePage token={token} />;
  return <HomePage />;
}
