Skip to content

Commit

Permalink
delete unused query, fix login error name
Browse files Browse the repository at this point in the history
  • Loading branch information
VladToby committed Oct 10, 2024
1 parent 0eb6e00 commit 37b1fd4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions packages/client/src/pages/SignIn/SignIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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<string | null>(null)
const [searchParams] = useSearchParams()
const [query] = useState(searchParams.get('redirectUrl'))
const navigate = useNavigate()
const dispatch = useAppDispatch()

Expand All @@ -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('Ошибка входа в аккаунт!')
})
}

Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/store/reducers/auth-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 37b1fd4

Please sign in to comment.