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

fix(ui): prevent reload after logout #3149

Merged
merged 3 commits into from
Jun 12, 2024

Conversation

erka
Copy link
Collaborator

@erka erka commented Jun 5, 2024

No description provided.

Copy link

codecov bot commented Jun 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.59%. Comparing base (f997fb9) to head (e53d2c2).
Report is 401 commits behind head on main.

Current head e53d2c2 differs from pull request most recent head 3536b54

Please upload reports for the commit 3536b54 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3149      +/-   ##
==========================================
+ Coverage   70.78%   71.59%   +0.80%     
==========================================
  Files          91      109      +18     
  Lines        8729     7987     -742     
==========================================
- Hits         6179     5718     -461     
+ Misses       2165     1842     -323     
- Partials      385      427      +42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@erka
Copy link
Collaborator Author

erka commented Jun 7, 2024

@markphelps I have one more thought about authentication for Flipt Cloud. I wonder what will happen when token is expired. Currently ui just reloads itself.

flipt/ui/src/data/api.ts

Lines 34 to 39 in 22a157c

if (!response.ok) {
if (response.status === 401) {
window.localStorage.removeItem(csrfTokenHeaderKey);
window.localStorage.removeItem(sessionKey);
window.location.reload();
}

Is it okay with Flipt Cloud?

@markphelps
Copy link
Collaborator

@markphelps I have one more thought about authentication for Flipt Cloud. I wonder what will happen when token is expired. Currently ui just reloads itself.

flipt/ui/src/data/api.ts

Lines 34 to 39 in 22a157c

if (!response.ok) {
if (response.status === 401) {
window.localStorage.removeItem(csrfTokenHeaderKey);
window.localStorage.removeItem(sessionKey);
window.location.reload();
}

Is it okay with Flipt Cloud?

I think if the ui reloads itself if Flipt Cloud is the only authentication method then they will just see the no configured providers screen in the Flipt UI. Maybe we should redirect them back to the iss (flipt cloud) here as well if the token is expired/we get a 401

@markphelps markphelps added needs docs Requires documentation updates and removed needs docs Requires documentation updates labels Jun 7, 2024
@erka erka marked this pull request as ready for review June 10, 2024 21:21
@erka erka requested a review from a team as a code owner June 10, 2024 21:21
@erka erka force-pushed the logout-without-reload branch 5 times, most recently from edf7a93 to 26dd87b Compare June 12, 2024 11:23
Signed-off-by: Roman Dmytrenko <rdmytrenko@gmail.com>
Copy link
Collaborator

@markphelps markphelps left a comment

Choose a reason for hiding this comment

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

one question! otherwise lgtm!

ui/src/components/SessionProvider.tsx Outdated Show resolved Hide resolved
Signed-off-by: Roman Dmytrenko <rdmytrenko@gmail.com>
Copy link
Collaborator

@markphelps markphelps left a comment

Choose a reason for hiding this comment

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

looks great! thank you!

@markphelps markphelps added the automerge Used by Kodiak bot to automerge PRs label Jun 12, 2024
@kodiakhq kodiakhq bot merged commit 9dfcbb8 into flipt-io:main Jun 12, 2024
29 checks passed
@erka erka deleted the logout-without-reload branch June 12, 2024 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Used by Kodiak bot to automerge PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants