"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; import { grantSuperUser } from "../superuser-requests/actions"; import { ShieldCheck } from "lucide-react"; export function GrantSuperUserButton({ userId }: { userId: string }) { const router = useRouter(); const [pending, setPending] = useState(false); const [error, setError] = useState(""); async function handle() { if (!confirm("Grant this user SuperUser access?")) return; setPending(true); setError(""); const result = await grantSuperUser(userId); setPending(false); if ("error" in result) setError(result.error); else router.refresh(); } return ( ); }