Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
exam_12_Tsoy_Danil
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Цой Данил
exam_12_Tsoy_Danil
Commits
c4608730
Commit
c4608730
authored
Apr 15, 2023
by
Цой Данил
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deleted not needed comments + rewrote titles in authorize form to match the idea
parent
5e15b7bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
19 deletions
+7
-19
Header.tsx
frontend/src/components/Header/Header.tsx
+1
-1
AuthorizeForm.tsx
frontend/src/containers/AuthorizeForm/AuthorizeForm.tsx
+6
-18
No files found.
frontend/src/components/Header/Header.tsx
View file @
c4608730
...
...
@@ -61,7 +61,7 @@ const Header: React.FunctionComponent = (): React.ReactElement => {
<
button
className=
{
styles
.
Header_button
}
onClick=
{
logoutHandler
}
>
Logout
</
button
>
</
div
>
:
<
div
>
<
button
className=
{
styles
.
Header_button
}
onClick=
{
()
=>
{
navigateToPage
(
'authorize'
)}
}
>
Login
</
button
>
<
button
className=
{
styles
.
Header_button
}
onClick=
{
()
=>
{
navigateToPage
(
'authorize'
)}
}
>
Authorize
</
button
>
</
div
>
}
</
div
>
...
...
frontend/src/containers/AuthorizeForm/AuthorizeForm.tsx
View file @
c4608730
...
...
@@ -24,7 +24,7 @@ const AuthorizeForm: React.FunctionComponent = (): React.ReactElement => {
const
[
buttonDisabled
,
setButtonDisabled
]
=
useState
<
boolean
>
(
true
)
const
[
isLoginUser
,
setIsLogin
User
]
=
useState
<
boolean
>
(
true
)
const
[
addNewUser
,
setAddNew
User
]
=
useState
<
boolean
>
(
true
)
const
[
showPassword
,
setShowPassword
]
=
useState
<
boolean
>
(
false
);
...
...
@@ -37,12 +37,12 @@ const AuthorizeForm: React.FunctionComponent = (): React.ReactElement => {
}
const
toggleChangeHandler
=
()
=>
{
set
IsLoginUser
(
!
isLogin
User
)
set
AddNewUser
(
!
addNew
User
)
}
const
submitHandler
=
async
(
e
:
FormEvent
)
=>
{
e
.
preventDefault
()
if
(
isLogin
User
){
if
(
addNew
User
){
await
dispatch
(
createUser
(
userValues
))
}
else
{
await
dispatch
(
loginUser
(
userValues
))
...
...
@@ -87,18 +87,7 @@ const AuthorizeForm: React.FunctionComponent = (): React.ReactElement => {
{
messageUser
}
</
Alert
>
:
null
}
<
p
>
{
isLoginUser
?
'Login user'
:
'Authorize user'
}
</
p
>
{
/* <OutlinedInput
label="Username"
name={'username'}
autoComplete='off'
value={userValues.username}
onChange={inputHandler}
style={{
marginBottom: '20px'
}}
/> */
}
<
p
>
{
addNewUser
?
'Register user'
:
'Log in user'
}
</
p
>
<
FormControl
sx=
{
{
m
:
1
,
width
:
'80%'
}
}
variant=
"outlined"
>
<
InputLabel
htmlFor=
"outlined-adornment-password"
>
Username
</
InputLabel
>
...
...
@@ -118,7 +107,6 @@ const AuthorizeForm: React.FunctionComponent = (): React.ReactElement => {
/>
</
FormControl
>
<
FormControl
sx=
{
{
m
:
1
,
width
:
'80%'
}
}
variant=
"outlined"
>
<
InputLabel
htmlFor=
"outlined-adornment-password"
>
Password
</
InputLabel
>
<
OutlinedInput
...
...
@@ -149,7 +137,7 @@ const AuthorizeForm: React.FunctionComponent = (): React.ReactElement => {
</
FormControl
>
<
FormControlLabel
control=
{
<
Switch
checked=
{
isLogin
User
}
checked=
{
addNew
User
}
onChange=
{
toggleChangeHandler
}
inputProps=
{
{
'aria-label'
:
'controlled'
}
}
/>
}
...
...
@@ -158,7 +146,7 @@ const AuthorizeForm: React.FunctionComponent = (): React.ReactElement => {
<
button
className=
{
styles
.
login_btn
}
disabled=
{
buttonDisabled
}
>
Authorize
</
button
>
>
{
addNewUser
?
'Register'
:
'Log in'
}
</
button
>
</
form
>
</
div
>
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment