Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
planner-team-one
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
21
Issues
21
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
Евгений Положенцев
planner-team-one
Commits
381bc083
Commit
381bc083
authored
Dec 11, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#94
added submit change user function
parent
550447c8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
17 deletions
+27
-17
SwitchUserForm.js
...mponents/SwitchUserModal/SwitchUserForm/SwitchUserForm.js
+1
-1
SwitchUserModal.js
...r-front/src/components/SwitchUserModal/SwitchUserModal.js
+10
-10
SwitchUserTable.js
...onents/SwitchUserModal/SwitchUserTable/SwitchUserTable.js
+13
-3
usersActions.js
planner-front/src/store/actions/usersActions.js
+3
-3
No files found.
planner-front/src/components/SwitchUserModal/SwitchUserForm/SwitchUserForm.js
View file @
381bc083
...
...
@@ -31,7 +31,7 @@ const SwitchUserForm=({submitFormHandler, users})=> {
<>
{
/* <Box sx={style}> */
}
{
users
?
<
form
onSubmit
=
{
submitFormHandler
}
>
<
form
onSubmit
=
{
(
e
)
=>
submitFormHandler
(
e
,
currentUser
)
}
>
<
Grid
container
direction
=
"column"
spacing
=
{
2
}
>
<
Typography
variant
=
"h5"
style
=
{{
margin
:
"5px"
,
textAlign
:
"center"
}}
>
Выберите
юзера
<
/Typography
>
...
...
planner-front/src/components/SwitchUserModal/SwitchUserModal.js
View file @
381bc083
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
Box
from
'@mui/material/Box'
;
import
Button
from
'@mui/material/Button'
;
import
Typography
from
'@mui/material/Typography'
;
import
Modal
from
'@mui/material/Modal'
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
fetchUsersAllFields
}
from
'../../store/actions/usersActions'
;
import
SwitchUserTable
from
'./SwitchUserTable/SwitchUserTable'
;
import
{
logoutUser
,
loginUser
}
from
'../../store/actions/usersActions'
;
import
SwitchUserForm
from
'./SwitchUserForm/SwitchUserForm'
;
import
{
useNavigate
}
from
"react-router-dom"
;
const
style
=
{
...
...
@@ -23,13 +20,16 @@ const style = {
};
const
SwitchUserModal
=
({
open
,
handleClose
})
=>
{
const
dispatch
=
useDispatch
();
const
usersAllFields
=
useSelector
(
state
=>
state
.
users
.
usersAllFields
)
const
submitFormHandler
=
(
e
)
=>
{
const
navigate
=
useNavigate
();
const
submitFormHandler
=
(
e
,
currentUser
)
=>
{
dispatch
(
logoutUser
(
navigate
))
e
.
preventDefault
();
console
.
log
(
'submitFormHandler'
,
'e.target.name '
,
e
.
target
.
name
,
'e.target.value '
,
e
.
target
.
value
)
dispatch
(
loginUser
({
"email"
:
currentUser
.
email
,
"password"
:
"123"
},
navigate
))
}
return
(
...
...
planner-front/src/components/SwitchUserModal/SwitchUserTable/SwitchUserTable.js
View file @
381bc083
...
...
@@ -13,11 +13,21 @@ const SwitchUserTable=({projectsRoles})=>{
return
(
<
TableContainer
component
=
{
Paper
}
>
<
Table
sx
=
{{
minWidth
:
4
50
}}
aria
-
label
=
"simple table"
>
<
Table
sx
=
{{
minWidth
:
3
50
}}
aria
-
label
=
"simple table"
>
<
TableHead
>
<
TableRow
>
<
TableCell
>
Проекты
<
/TableCell
>
<
TableCell
align
=
"right"
>
Роли
<
/TableCell
>
<
TableCell
sx
=
{{
'backgroundColor'
:
'black'
,
'color'
:
'white'
}}
>
Проекты
<
/TableCell
>
<
TableCell
sx
=
{{
'backgroundColor'
:
'black'
,
'color'
:
'white'
}}
align
=
"right"
>
Роли
<
/TableCell
>
<
/TableRow
>
<
/TableHead
>
<
TableBody
>
...
...
planner-front/src/store/actions/usersActions.js
View file @
381bc083
...
...
@@ -83,7 +83,7 @@ export const loginUser = (userData, navigate) => {
export
const
forgottenPassword
=
(
userData
,
navigate
)
=>
{
return
async
(
dispatch
)
=>
{
try
{
console
.
log
(
userData
)
console
.
log
(
'forgottenPassword userData '
,
userData
)
const
response
=
await
axios
.
post
(
"users/requestPasswordReset"
,
userData
);
// if (userData.email === response.data.email) {
...
...
@@ -130,9 +130,9 @@ export const fetchUsersAllFields = () => {
try
{
const
response
=
await
axios
.
get
(
"/users/all-fields/"
);
dispatch
(
fetchUsersAllFieldsSuccess
(
response
.
data
.
users
));
console
.
log
(
"users/all-fields/ "
,
response
.
data
.
users
)
}
catch
(
e
)
{
dispatch
(
fetchUsersAllFieldsFailure
(
e
));
}
}
};
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