import {useAuth} from "../context/AuthContext.tsx";
import {Navigate} from "react-router-dom";
import React from "react";

export const PrivateRoute = ({ children} : {children: React.ReactNode}) => {
  const {isAuthenticated } = useAuth();
  return isAuthenticated ? <> {children}</>: <Navigate to="/login" replace={true} />;
}