Skip to content
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

Add logout button - closes #1653 #1686

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

trezp
Copy link
Contributor

@trezp trezp commented Mar 22, 2023

Closes #1653

  • Adds log out button to header
  • Conditionally renders based on "logged in" status
  • Empties records search form on log out

Screen Shot 2023-03-22 at 2 17 20 PM

@trezp trezp requested a review from KentShikama March 22, 2023 21:15
Copy link
Member

@KentShikama KentShikama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for giving this another shot!

src/frontend/src/components/Header/index.tsx Outdated Show resolved Hide resolved
useEffect(() => {
setLoggedIn(isLoggedIn());
}, [location]);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance we could refactor this to use something like https://www.npmjs.com/package/react-cookie? It feels a bit odd to hook into location for this kind of thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KentShikama Can you tell me more about why this bothers you and what you would prefer to be done with this package?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KentShikama react-cookie wasn't going to work because it doesn't trigger a re-render when the cookies change, but I pushed another solution. Looks like I need to update so front end tests are passing though. Will re-request a review once I button that up.

Copy link
Member

@KentShikama KentShikama May 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trezp Pardon the delay in reply. It is just that the use of the location is "indirect" and anything indirect when it doesn't need to be adds complexity. Ideally, we would be reacting to when the cookie is added/removed/expired as that is what the status of the login button should reflect.

Copy link
Member

@KentShikama KentShikama May 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trezp

react-cookie wasn't going to work because it doesn't trigger a re-render when the cookies change

Ah ok. Pardon for taking you down that path then.

@KentShikama KentShikama self-requested a review March 24, 2023 01:54
Copy link
Member

@KentShikama KentShikama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pardon. Didn't mean to approve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create feature to log out of OECI credentials
2 participants