Skip to content

Commit 8ee378b

Browse files
committed
refactor: The line length in the linter has been changed to 120.
1 parent 93782c8 commit 8ee378b

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

frontend/src/routes/recover-password.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1+
// --- НАЧАЛО ИСПРАВЛЕННОГО КОДА ---
12
import { Container, Heading, Input, Text } from "@chakra-ui/react"
23
import { useMutation } from "@tanstack/react-query"
34
import { createFileRoute, redirect } from "@tanstack/react-router"
45
import { type SubmitHandler, useForm } from "react-hook-form"
56
import { FiMail } from "react-icons/fi"
67

7-
import { type ApiError, LoginService } from "@/client"
8+
import { type ApiError, loginLoginRouterRecoverPassword } from "@/client"
89
import { Button } from "@/components/ui/button"
910
import { Field } from "@/components/ui/field"
1011
import { InputGroup } from "@/components/ui/input-group"
1112
import { isLoggedIn } from "@/hooks/useAuth"
1213
import useCustomToast from "@/hooks/useCustomToast"
13-
import { emailPattern, handleError } from "@/utils"
14+
// --- ИЗМЕНЕНИЕ ---: Импорт handleError удален
15+
import { emailPattern } from "@/utils"
1416

1517
interface FormData {
1618
email: string
@@ -34,10 +36,11 @@ function RecoverPassword() {
3436
reset,
3537
formState: { errors, isSubmitting },
3638
} = useForm<FormData>()
37-
const { showSuccessToast } = useCustomToast()
39+
// --- ИЗМЕНЕНИЕ ---: Получаем showApiErrorToast из хука
40+
const { showSuccessToast, showApiErrorToast } = useCustomToast()
3841

3942
const recoverPassword = async (data: FormData) => {
40-
await LoginService.recoverPassword({
43+
await loginLoginRouterRecoverPassword({
4144
email: data.email,
4245
})
4346
}
@@ -49,12 +52,13 @@ function RecoverPassword() {
4952
reset()
5053
},
5154
onError: (err: ApiError) => {
52-
handleError(err)
55+
// --- ИЗМЕНЕНИЕ ---: Используем новый, правильный метод
56+
showApiErrorToast(err)
5357
},
5458
})
5559

56-
const onSubmit: SubmitHandler<FormData> = async (data) => {
57-
mutation.mutate(data)
60+
const onSubmit: SubmitHandler<FormData> = (data) => {
61+
void mutation.mutate(data)
5862
}
5963

6064
return (
@@ -71,9 +75,7 @@ function RecoverPassword() {
7175
<Heading size="xl" color="ui.main" textAlign="center" mb={2}>
7276
Password Recovery
7377
</Heading>
74-
<Text textAlign="center">
75-
A password recovery email will be sent to the registered account.
76-
</Text>
78+
<Text textAlign="center">A password recovery email will be sent to the registered account.</Text>
7779
<Field invalid={!!errors.email} errorText={errors.email?.message}>
7880
<InputGroup w="100%" startElement={<FiMail />}>
7981
<Input
@@ -93,3 +95,4 @@ function RecoverPassword() {
9395
</Container>
9496
)
9597
}
98+
// --- КОНЕЦ ИСПРАВЛЕННОГО КОДА ---

0 commit comments

Comments
 (0)