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
Hide 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})=> {
...
@@ -31,7 +31,7 @@ const SwitchUserForm=({submitFormHandler, users})=> {
<>
<>
{
/* <Box sx={style}> */
}
{
/* <Box sx={style}> */
}
{
users
?
{
users
?
<
form
onSubmit
=
{
submitFormHandler
}
>
<
form
onSubmit
=
{
(
e
)
=>
submitFormHandler
(
e
,
currentUser
)
}
>
<
Grid
container
direction
=
"column"
spacing
=
{
2
}
>
<
Grid
container
direction
=
"column"
spacing
=
{
2
}
>
<
Typography
variant
=
"h5"
style
=
{{
margin
:
"5px"
,
textAlign
:
"center"
}}
>
Выберите
юзера
<
/Typography
>
<
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
React
,
{
useEffect
,
useState
}
from
'react'
;
import
Box
from
'@mui/material/Box'
;
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
Modal
from
'@mui/material/Modal'
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
fetchUsersAllFields
}
from
'../../store/actions/usersActions'
;
import
{
logoutUser
,
loginUser
}
from
'../../store/actions/usersActions'
;
import
SwitchUserTable
from
'./SwitchUserTable/SwitchUserTable'
;
import
SwitchUserForm
from
'./SwitchUserForm/SwitchUserForm'
;
import
SwitchUserForm
from
'./SwitchUserForm/SwitchUserForm'
;
import
{
useNavigate
}
from
"react-router-dom"
;
const
style
=
{
const
style
=
{
...
@@ -23,13 +20,16 @@ const style = {
...
@@ -23,13 +20,16 @@ const style = {
};
};
const
SwitchUserModal
=
({
open
,
handleClose
})
=>
{
const
SwitchUserModal
=
({
open
,
handleClose
})
=>
{
const
dispatch
=
useDispatch
();
const
usersAllFields
=
useSelector
(
state
=>
state
.
users
.
usersAllFields
)
const
usersAllFields
=
useSelector
(
state
=>
state
.
users
.
usersAllFields
)
const
navigate
=
useNavigate
();
const
submitFormHandler
=
(
e
)
=>
{
const
submitFormHandler
=
(
e
,
currentUser
)
=>
{
dispatch
(
logoutUser
(
navigate
))
e
.
preventDefault
();
e
.
preventDefault
();
console
.
log
(
'submitFormHandler'
,
dispatch
(
loginUser
({
'e.target.name '
,
e
.
target
.
name
,
"email"
:
currentUser
.
email
,
'e.target.value '
,
e
.
target
.
value
)
"password"
:
"123"
},
navigate
))
}
}
return
(
return
(
...
...
planner-front/src/components/SwitchUserModal/SwitchUserTable/SwitchUserTable.js
View file @
381bc083
...
@@ -13,11 +13,21 @@ const SwitchUserTable=({projectsRoles})=>{
...
@@ -13,11 +13,21 @@ const SwitchUserTable=({projectsRoles})=>{
return
(
return
(
<
TableContainer
component
=
{
Paper
}
>
<
TableContainer
component
=
{
Paper
}
>
<
Table
sx
=
{{
minWidth
:
4
50
}}
aria
-
label
=
"simple table"
>
<
Table
sx
=
{{
minWidth
:
3
50
}}
aria
-
label
=
"simple table"
>
<
TableHead
>
<
TableHead
>
<
TableRow
>
<
TableRow
>
<
TableCell
>
Проекты
<
/TableCell
>
<
TableCell
<
TableCell
align
=
"right"
>
Роли
<
/TableCell
>
sx
=
{{
'backgroundColor'
:
'black'
,
'color'
:
'white'
}}
>
Проекты
<
/TableCell
>
<
TableCell
sx
=
{{
'backgroundColor'
:
'black'
,
'color'
:
'white'
}}
align
=
"right"
>
Роли
<
/TableCell
>
<
/TableRow
>
<
/TableRow
>
<
/TableHead
>
<
/TableHead
>
<
TableBody
>
<
TableBody
>
...
...
planner-front/src/store/actions/usersActions.js
View file @
381bc083
...
@@ -83,7 +83,7 @@ export const loginUser = (userData, navigate) => {
...
@@ -83,7 +83,7 @@ export const loginUser = (userData, navigate) => {
export
const
forgottenPassword
=
(
userData
,
navigate
)
=>
{
export
const
forgottenPassword
=
(
userData
,
navigate
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
try
{
try
{
console
.
log
(
userData
)
console
.
log
(
'forgottenPassword userData '
,
userData
)
const
response
=
await
axios
.
post
(
"users/requestPasswordReset"
,
userData
);
const
response
=
await
axios
.
post
(
"users/requestPasswordReset"
,
userData
);
// if (userData.email === response.data.email) {
// if (userData.email === response.data.email) {
...
@@ -130,9 +130,9 @@ export const fetchUsersAllFields = () => {
...
@@ -130,9 +130,9 @@ export const fetchUsersAllFields = () => {
try
{
try
{
const
response
=
await
axios
.
get
(
"/users/all-fields/"
);
const
response
=
await
axios
.
get
(
"/users/all-fields/"
);
dispatch
(
fetchUsersAllFieldsSuccess
(
response
.
data
.
users
));
dispatch
(
fetchUsersAllFieldsSuccess
(
response
.
data
.
users
));
console
.
log
(
"users/all-fields/ "
,
response
.
data
.
users
)
}
catch
(
e
)
{
}
catch
(
e
)
{
dispatch
(
fetchUsersAllFieldsFailure
(
e
));
dispatch
(
fetchUsersAllFieldsFailure
(
e
));
}
}
}
}
};
};
\ No newline at end of file
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