"use client"; import { updatePasswordAction } from "@/app/(dashboard)/ajustes/actions"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { RiEyeLine, RiEyeOffLine } from "@remixicon/react"; import { useState, useTransition } from "react"; import { toast } from "sonner"; export function UpdatePasswordForm() { const [isPending, startTransition] = useTransition(); const [newPassword, setNewPassword] = useState(""); const [confirmPassword, setConfirmPassword] = useState(""); const [showNewPassword, setShowNewPassword] = useState(false); const [showConfirmPassword, setShowConfirmPassword] = useState(false); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); startTransition(async () => { const result = await updatePasswordAction({ newPassword, confirmPassword, }); if (result.success) { toast.success(result.message); setNewPassword(""); setConfirmPassword(""); } else { toast.error(result.error); } }); }; return (
); }