import { useNavigate, useLocation, FC } from '@/imports';

const B2BIndex: FC = () => {
  const navigate = useNavigate();
  const location = useLocation();
  const { pathname } = location;
  
  if (pathname === '/dashboard/b2b' || pathname === '/dashboard/b2b/') {
    navigate('/dashboard/b2b-trade', { replace: true });
    return null;
  }
  if (pathname.includes('/batch-order')) {
    navigate('/dashboard/b2b-trade', { replace: true });
    return null;
  }
  if (pathname.includes('/enterprise-quote')) {
    navigate('/dashboard/b2b-trade', { replace: true });
    return null;
  }
  if (pathname.includes('/contract-manage')) {
    navigate('/dashboard/b2b-trade', { replace: true });
    return null;
  }
  navigate('/dashboard/b2b-trade', { replace: true });
  return null;
};

export default B2BIndex;
