-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat(React): Avatar dropdown menu and logout function #2115
feat(React): Avatar dropdown menu and logout function #2115
Conversation
@gabe-lyons @jjoyce0510 @shirshanka |
if (!isLoggedIn) { | ||
return <Redirect to="/login" />; | ||
} |
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.
do you need this redirect? Each page is wrapped in a ProtectedRoute component which should be doing this redirect for you
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.
You are right, this is removed now.
/> | ||
</Link> | ||
<Dropdown overlay={menu}> | ||
<Link to={`/${entityRegistry.getPathName(EntityType.CorpUser)}/${_urn}`}> |
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.
nice re-fix 👍
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.
looks great, thanks @brendansun. I do think you may be able to remove the redirect logic though.
const isLoggedIn = checkAuthStatus(); | ||
|
||
const handleLogout = () => { | ||
Cookies.remove('PLAY_SESSION'); |
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.
technically, this line isn't doing anything. the play cookie is http only, so js isn't able to read or write it
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.
This line is removed now.
@gabe-lyons Comments resolved, please review again. Thanks! |
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.
perfect 🚀
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.
LGTM!
Although we never want people to log out of DataHub :)
Thanks Brendan! |
Scope
This PR changes all page that includes the header bar.
Changes
This PR adds new feature which pops up a menu when hovering on profile on top right corner of the page. Currently, there is only 1 option, that is to log out. After this option is clicked, user session is cleared and users are redirected to the login page.
This PR also contains a overwritten changes in #2095 where multiple clicking on the profile will redirect users to url like "user/user/user/user/..."
Checklist