"use client"; import { VerifyUser } from "@/actions/user-actions"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; import { Button } from "@/components/ui/button"; import type { User } from "@prisma/client"; import { Check, CheckCheck } from "lucide-react"; import { useState } from "react"; import { toast } from "sonner"; export function UserVerifyDialog({ user }: { user: User }) { const userId = user.id; const [disabled, setDisabled] = useState(false); return ( Are you sure? Are you sure you want to verify {user.name}? Cancel { setDisabled(true); toast.promise(VerifyUser(userId), { loading: "Verifying...", success: () => { setDisabled(false); return "User Verified!"; }, error: () => { setDisabled(false); return "Something went wrong"; }, }); }} > {disabled ? "Verifying..." : "Verify"} ); }