import React from "react";
import { Navigate } from "react-router-dom";

const RootRedirect = () => {
  const isAuthenticated = !!localStorage.getItem("jwtToken");
  return isAuthenticated ? (
    <Navigate to="/dashboard" replace />
  ) : (
    <Navigate to="/auth/login" replace />
  );
};

export default RootRedirect;
