import { ReactElement } from 'react';
import { Navigate, Outlet, To } from 'react-router-dom';
import { useAppSelector } from '../../hooks';
import {} from '../../store';

export const AuthRoute = ({
  redirectUrl = '/',
  children
}: {
  redirectUrl?: To;
  children?: ReactElement | null;
}) => {
  const auth = false; // useAppSelector();

  return auth ?
    (children ? children : <Outlet />) :
    <Navigate to={redirectUrl} replace />;
};
