import React from "react";
import { Navigate } from "react-router-dom";
import { getToken } from "utils/tokenService";

const ProtectedRoute = ({ children }) => {
    console.log(`token for checking whether authenticated: ${getToken()}`);
  const isAuthenticated = getToken() !== null; // Check if user is authenticated
  return isAuthenticated ? children : <Navigate to="/auth/login" replace />;
};

export default ProtectedRoute;
