import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form'; import { useResetPassword } from '@/modules/auth/hooks/use-auth-hook'; import { zUserResetPasswordDto } from '@/sdk/zod.gen'; import { zodResolver } from '@hookform/resolvers/zod'; import { useForm } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import type { z } from 'zod'; import { Link, useSearch } from '@tanstack/react-router'; import { Route as LoginRoute } from '@/routes/auth/login'; import { resetPasswordFormDefaults } from '@/modules/auth/schemas/form-schemas'; type ResetPasswordFormData = z.infer; export function ResetPasswordForm() { const { t } = useTranslation(); const { mutate, isPending } = useResetPassword(); const search = useSearch({ from: '/auth/reset-password' }); const form = useForm({ resolver: zodResolver(zUserResetPasswordDto), defaultValues: { ...resetPasswordFormDefaults, email: search.email || '', }, }); const onSubmit = (data: ResetPasswordFormData) => { mutate({ body: data }); }; return (

{t('auth.resetPassword.title')}

( {t('auth.resetPassword.email')} * )} /> ( {t('auth.resetPassword.otp')} * )} /> ( {t('auth.resetPassword.password')} * )} />
{t('auth.forgotPassword.loginLink')}
); }