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
9b875917
Commit
9b875917
authored
Dec 09, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#92
исправил ошибку при выходе из профиля
parent
37bf7db6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
9 deletions
+6
-9
users.ts
planner-api/src/routers/users.ts
+1
-0
ProfileBlock.js
...r-front/src/components/Menus/ProfileBlock/ProfileBlock.js
+3
-3
usersActions.js
planner-front/src/store/actions/usersActions.js
+2
-6
No files found.
planner-api/src/routers/users.ts
View file @
9b875917
...
@@ -100,6 +100,7 @@ router.delete('/sessions', async(req: Request, res: Response):Promise<void | obj
...
@@ -100,6 +100,7 @@ router.delete('/sessions', async(req: Request, res: Response):Promise<void | obj
if
(
!
user
)
return
res
.
send
({
successMsg
});
if
(
!
user
)
return
res
.
send
({
successMsg
});
user
.
token
=
nanoid
();
user
.
token
=
nanoid
();
await
user
.
save
();
await
user
.
save
();
return
res
.
send
(
successMsg
)
})
})
...
...
planner-front/src/components/Menus/ProfileBlock/ProfileBlock.js
View file @
9b875917
...
@@ -18,8 +18,8 @@ const ProfileBlock = () => {
...
@@ -18,8 +18,8 @@ const ProfileBlock = () => {
setAnchorEl
(
null
);
setAnchorEl
(
null
);
};
};
const
logout
=
async
()
=>
{
const
logout
=
()
=>
{
await
dispatch
(
logoutUser
(
navigate
));
dispatch
(
logoutUser
(
navigate
));
handleClose
()
handleClose
()
}
}
return
<>
return
<>
...
@@ -37,7 +37,7 @@ const ProfileBlock = () => {
...
@@ -37,7 +37,7 @@ const ProfileBlock = () => {
>
>
<
MenuItem
component
=
{
NavLink
}
to
=
"/profile/test"
color
=
"inherit"
onClick
=
{
handleClose
}
>
Profile
<
/MenuItem
>
<
MenuItem
component
=
{
NavLink
}
to
=
"/profile/test"
color
=
"inherit"
onClick
=
{
handleClose
}
>
Profile
<
/MenuItem
>
<
MenuItem
onClick
=
{
logout
}
>
Logout
<
/MenuItem
>
<
MenuItem
onClick
=
{
()
=>
{
logout
()}
}
>
Logout
<
/MenuItem
>
<
/Menu
>
<
/Menu
>
<
/
>
<
/
>
};
};
...
...
planner-front/src/store/actions/usersActions.js
View file @
9b875917
...
@@ -85,13 +85,9 @@ export const forgottenPassword = (userData, navigate) => {
...
@@ -85,13 +85,9 @@ export const forgottenPassword = (userData, navigate) => {
}
}
export
const
logoutUser
=
(
navigate
)
=>
{
export
const
logoutUser
=
(
navigate
)
=>
{
return
async
(
dispatch
,
getState
)
=>
{
return
async
(
dispatch
)
=>
{
try
{
try
{
await
axios
.
delete
(
"/users/sessions"
,
{
await
axios
.
delete
(
"/users/sessions"
);
headers
:
{
'Authorization'
:
getState
().
users
.
user
?.
token
}
});
dispatch
(
logoutUserSuccess
());
dispatch
(
logoutUserSuccess
());
navigate
(
"/"
);
navigate
(
"/"
);
dispatch
(
showNotification
(
"Вы успешно вышли"
));
dispatch
(
showNotification
(
"Вы успешно вышли"
));
...
...
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