From 37b1fd460aec142984d0d0d54d5dc50a32854c8b Mon Sep 17 00:00:00 2001 From: Toby Date: Thu, 10 Oct 2024 21:07:55 +0400 Subject: [PATCH] delete unused query, fix login error name --- packages/client/src/pages/SignIn/SignIn.tsx | 10 ++++------ packages/client/src/store/reducers/auth-reducer.ts | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/client/src/pages/SignIn/SignIn.tsx b/packages/client/src/pages/SignIn/SignIn.tsx index 55324f1..c928a9c 100644 --- a/packages/client/src/pages/SignIn/SignIn.tsx +++ b/packages/client/src/pages/SignIn/SignIn.tsx @@ -3,7 +3,7 @@ import React, { useState } from 'react' import { useAppDispatch } from '@/store' import { signInUser } from '@/store/reducers/auth-reducer' import { Button } from '@/components/ui/Button/Button' -import { Link, useSearchParams } from 'react-router-dom' +import { Link } from 'react-router-dom' import { useNavigate } from 'react-router-dom' import { Form } from '@/components/ui/Form/Form' import { Input } from '@/components/ui/Input/Input' @@ -13,8 +13,6 @@ import SiteLogo from '@/assets/images/site-logo.svg' export const SignIn = () => { const [userData, setUserData] = useState({ login: '', password: '' }) const [error, setError] = useState(null) - const [searchParams] = useSearchParams() - const [query] = useState(searchParams.get('redirectUrl')) const navigate = useNavigate() const dispatch = useAppDispatch() @@ -27,13 +25,13 @@ export const SignIn = () => { } const handleSubmit = () => { - dispatch(signInUser({ form: userData, query: query })) + dispatch(signInUser({ form: userData })) .unwrap() .then(() => { navigate('/game') }) - .catch((error?: any, code?: any) => { - setError('Ошибка! Не правильный логин или пароль.') + .catch((_error?: any, _code?: any) => { + setError('Ошибка входа в аккаунт!') }) } diff --git a/packages/client/src/store/reducers/auth-reducer.ts b/packages/client/src/store/reducers/auth-reducer.ts index c02cb55..d983198 100644 --- a/packages/client/src/store/reducers/auth-reducer.ts +++ b/packages/client/src/store/reducers/auth-reducer.ts @@ -77,7 +77,7 @@ type TypeSignInForm = { export const signInUser = createAsyncThunk( 'AuthUser/signInUser', - async (data: { form: TypeSignInForm; query?: string | null }, thunkAPI) => { + async (data: { form: TypeSignInForm }, thunkAPI) => { try { const response = await backendApi({ method: 'post',