import { Form, FormField, FormButtons, PasswordField, Button, FormSubmitButton, } from '@umami/react-zen'; import { useApi, useMessages } from '@/components/hooks'; export function PasswordEditForm({ onSave, onClose }) { const { formatMessage, labels, messages } = useMessages(); const { post, useMutation } = useApi(); const { mutate, error, isPending } = useMutation({ mutationFn: (data: any) => post('/me/password', data), }); const handleSubmit = async (data: any) => { mutate(data, { onSuccess: async () => { onSave(); onClose(); }, }); }; const samePassword = (value: string, values: { [key: string]: any }) => { if (value !== values.newPassword) { return formatMessage(messages.noMatchPassword); } return true; }; return (
); }