import { Navigate } from "react-router-dom";
import { useAppSelector } from "@/store";
import { ReactNode } from "react";

export default function PrivateRoute({ children }: { children: ReactNode }) {
  const token = useAppSelector((s) => s.auth.token);
  if (!token) return <Navigate to="/login" replace />;
  return <>{children}</>;
}
