'use client';

import { useEffect } from 'react';
import { useSearchParams } from 'next/navigation';

import { buildAuthPortalUrl } from '@/lib/auth-portal';

export default function LoginRedirectPage() {
  const searchParams = useSearchParams();

  useEffect(() => {
    const nextPath = searchParams?.get('next') || '/';
    window.location.replace(buildAuthPortalUrl('/login', nextPath));
  }, [searchParams]);

  return (
    <div className="flex min-h-screen items-center justify-center px-4">
      <div className="text-sm text-muted-foreground">正在跳转到登录门户...</div>
    </div>
  );
}
