add errors handlers and translate
This commit is contained in:
@@ -2,9 +2,8 @@
|
||||
|
||||
import styles from '@/app/styles/module/login.module.scss'
|
||||
import { useActionState } from 'react';
|
||||
|
||||
import { useTranslations } from 'next-intl';
|
||||
import {resetPassword} from '@/app/actions/auth';
|
||||
import { resetPassword } from '@/app/actions/auth';
|
||||
|
||||
export default function ForgotPasswordForm() {
|
||||
const [state, formAction, isPending] = useActionState(
|
||||
@@ -26,19 +25,14 @@ export default function ForgotPasswordForm() {
|
||||
className={`${styles['form-input']}`}
|
||||
placeholder={t('enter-email')}
|
||||
/>
|
||||
{/* {state === 'error' && (
|
||||
{state?.error === 'error' && (
|
||||
<p className={`${styles['form-error']}`}>
|
||||
Восстановление пароля не работает
|
||||
{t('register-error-email-invalid')}
|
||||
</p>
|
||||
)} */}
|
||||
)}
|
||||
</div>
|
||||
{/* {state?.error.server && (
|
||||
<p className={`${styles['form-error']}`}>
|
||||
{t(state?.error.server)}
|
||||
</p>
|
||||
)} */}
|
||||
<button type="submit" className={`${styles['btn']}`}>
|
||||
Восстановить пароль
|
||||
{t('recover-password')}
|
||||
</button>
|
||||
</form>
|
||||
)
|
||||
|
||||
@@ -112,14 +112,14 @@ export default function ResetPasswordForm() {
|
||||
</div>
|
||||
<div className={`${styles['form-group']}`}>
|
||||
<label className={`${styles['form-label']} ${styles['required']}`}>
|
||||
Код восстановления
|
||||
{t('recovery-code')}
|
||||
</label>
|
||||
<input
|
||||
type="readOnly"
|
||||
id="verify-token"
|
||||
name="verify-token"
|
||||
className={`${styles['form-input']}`}
|
||||
placeholder={'Код восстановления'}
|
||||
placeholder={t('recovery-code')}
|
||||
defaultValue={formState?.previousState?.verifyToken ? formState?.previousState?.verifyToken : ''}
|
||||
/>
|
||||
</div>
|
||||
@@ -201,7 +201,7 @@ export default function ResetPasswordForm() {
|
||||
</p>
|
||||
)} */}
|
||||
<button type="submit" className={`${styles['btn']}`}>
|
||||
Изменить пароль
|
||||
{t('change-password')}
|
||||
</button>
|
||||
</form>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user