From 419eed81e61c703c69b695955c7993ecd5467c71 Mon Sep 17 00:00:00 2001 From: user Date: Sat, 25 May 2024 07:20:57 +0300 Subject: [PATCH] fix unused vars --- src/pages/root/steps/data-step/index.tsx | 53 +++++++++++------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/src/pages/root/steps/data-step/index.tsx b/src/pages/root/steps/data-step/index.tsx index eaa7de9..ab14327 100644 --- a/src/pages/root/steps/data-step/index.tsx +++ b/src/pages/root/steps/data-step/index.tsx @@ -3,7 +3,6 @@ import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; import ReactPlayer from "react-player/lazy"; -import { useNavigate } from "react-router-dom"; import { FormLabel } from "~/shared/ui/form-label"; import { Input } from "~/shared/ui/input"; @@ -14,7 +13,6 @@ import { HiddenFileInput } from "~/shared/ui/hidden-file-input"; import { useRootStore } from "~/shared/stores/root"; import { Checkbox } from "~/shared/ui/checkbox"; import { useAuth } from "~/shared/services/auth"; -import { Routes } from "~/app/router/constants"; type DataStepProps = { nextStep(): void; @@ -24,8 +22,6 @@ export const DataStep = ({ nextStep }: DataStepProps) => { const rootStore = useRootStore(); const auth = useAuth(); - const navigate = useNavigate(); - const formSchema = useMemo(() => { return z.object({ name: z.string().min(1, "Обязательное поле"), @@ -45,24 +41,24 @@ export const DataStep = ({ nextStep }: DataStepProps) => { }, }); - // const handleSubmit = () => { - // form.handleSubmit(async (values: FormValues) => { - // try { - // rootStore.setName(values.name); - // - // if (values.author) { - // rootStore.setAuthor(values.author); - // } - // - // const res = await auth.mutateAsync(); - // sessionStorage.setItem("auth_v1_token", res.data.auth_v1_token); - // - // nextStep(); - // } catch (error) { - // console.error("Error:", error); - // } - // })(); - // }; + const handleSubmit = () => { + form.handleSubmit(async (values: FormValues) => { + try { + rootStore.setName(values.name); + + if (values.author) { + rootStore.setAuthor(values.author); + } + + const res = await auth.mutateAsync(); + sessionStorage.setItem("auth_v1_token", res.data.auth_v1_token); + + nextStep(); + } catch (error) { + console.error("Error:", error); + } + })(); + }; return (
@@ -158,15 +154,14 @@ export const DataStep = ({ nextStep }: DataStepProps) => {
);