import { Redirect } from 'react-router-dom';
import MainLayout from '../layouts/main';
import RegisterContent from './content';
import { useIsAuthenticated } from '../../redux/hooks/auth';
import { DEFAULT_DECKS_ROUTE } from '../utils/index';

function RegisterPage() {
  const isAuthenticated = useIsAuthenticated();
  if (isAuthenticated) return <Redirect to={DEFAULT_DECKS_ROUTE} />;

  return (
    <MainLayout loginRequired={false}>
      <RegisterContent />
    </MainLayout>
  );
}

export default RegisterPage;
