import { Navigate } from "react-router-dom";
import { getAdminToken } from "../../lib/adminAuth";
import { ADMIN_BASE } from "../../lib/config";

export default function RequireAdmin({ children }: { children: React.ReactNode }) {
    return getAdminToken() ? <>{children}</> : <Navigate to={`${ADMIN_BASE}/login`} replace />;
}
