import React from "react";
//import { StaticRouter } from "react-router-dom/server";
import { Link } from "react-router-dom";
import Login from "./login";
// Function to check if the user is authenticated (You can implement this based on your authentication method)
const PrivateRoute = ({ component: Component }) => {
const isAuthenticated = () => {
// Check if the user is authenticated (e.g., check for a valid authentication token in local storage)
return localStorage.getItem("authToken") !== null;
};
return isAuthenticated() ? (
{" "}
Dashboard{" "}
) : (
{" "}
Login{" "}
);
};
export default PrivateRoute;