-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SOK-15] Login Page #14
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Страница логина выглядит круто! Спасибо за работу.
.unwrap() | ||
.then(() => { | ||
navigate('/game') | ||
}) | ||
.catch((error?: any, code?: any) => { | ||
toast.error(error.reason) | ||
setError('Ошибка! Не правильный логин или пароль.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
По хорошему нужно вообще запретить залогиненому пользователю заходить на страницы логина и регистрации
<div className={'login-page__error-message'}>{error}</div> | ||
)} | ||
</Form> | ||
<Button text={'Войти'} useFixWidth={true} onClick={handleSubmit} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Возможно тут стоит добавить пропс type
. И тогда можно будет метод handleSubmit
переименовать в trySingIn
.
handleSubmit
просто не дает понимания что конкретно произойдет по клику, кроме того, что он будет обработан)
text={'Регистрация'} | ||
useFixWidth={true} | ||
onClick={() => { | ||
navigate('/sign-up') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Как будто это не кнопка, а ссылка.
|
||
const handleSubmit = () => { | ||
dispatch(signInUser({ form: form, query: query })) | ||
dispatch(signInUser({ form: userData, query: query })) | ||
.unwrap() | ||
.then(() => { | ||
navigate('/game') | ||
}) | ||
.catch((error?: any, code?: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(error?: any, code?: any)
не используются.
Если есть силы, добавить в lint`ер такую проверку было бы отлично.
|
||
export const SignIn = () => { | ||
const [form, setForm] = useState({ login: '', password: '' }) | ||
const [userData, setUserData] = useState({ login: '', password: '' }) | ||
const [error, setError] = useState<string | null>(null) | ||
const [searchParams] = useSearchParams() | ||
const [query] = useState(searchParams.get('redirectUrl')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А зачем тут использовать useState? Мб просто const лучше?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@k0ndratov В этой строке const [query] = useState(searchParams.get('redirectUrl'))
или в моих?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да, в строке. Вроде query не меняет свое состояние, тогда зачем использотьва useState?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Так эта строка к конкретному реквесту отношения не имеет просто
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно и порефакторить =) Сейчас вообще query не используется.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А, действительно не имеет. Не заметил. Сорре.
margin-bottom: auto; | ||
width: 768px; | ||
|
||
.row { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Возможно стоит уточнить у @Timur233.
У нас такой класс есть в grid-system. Не создает ли это проблем.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не создаёт, потому что используется в конкретном месте в SignIn.scss
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Значит ты теряешь возможность использовать .row
из grid-system
в SignIn.scss
. Что, возможно, потенциальная проблема.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Так я изменяю его в конкретном месте, так же как и ширину контейнера выше например
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Отличная работа!
|
||
export const SignIn = () => { | ||
const [form, setForm] = useState({ login: '', password: '' }) | ||
const [userData, setUserData] = useState({ login: '', password: '' }) | ||
const [error, setError] = useState<string | null>(null) | ||
const [searchParams] = useSearchParams() | ||
const [query] = useState(searchParams.get('redirectUrl')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно и порефакторить =) Сейчас вообще query не используется.
[### Какую задачу решаем] (https://linear.app/sokoly/issue/SOK-15/vyorstka-stranicy-logina)
Скриншоты/видяшка (если есть)
TBD (если есть)
Изменить страницу профиля используя миксин