Skip to content

Commit 44f8802

Browse files
logout: reload user info after logout, instead of assuming null (#4383) (#4387)
because the UI doesn't really know about the anonymous user, except from the API so.. logout would set user to null, going through the codepath that redirects to /login, which would go to github and log in again instead, reloading the info when in anonymous mode, the user gets set to the anonymous user, with no redirects Issue: AAH-2726 (cherry picked from commit ceba5a3) Co-authored-by: Martin Hradil <mhradil@redhat.com>
1 parent 56dab62 commit 44f8802

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGES/2726.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
logout: reload user info after logout, instead of assuming null

src/loaders/standalone/layout.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ export const StandaloneLayout = ({
7979
<DropdownItem
8080
key='logout'
8181
aria-label={'logout'}
82-
onClick={() => ActiveUserAPI.logout().then(() => setUser(null))}
82+
onClick={() =>
83+
ActiveUserAPI.logout()
84+
.then(() => ActiveUserAPI.getUser().catch(() => null))
85+
.then((user) => setUser(user))
86+
}
8387
>
8488
{t`Logout`}
8589
</DropdownItem>,

0 commit comments

Comments
 (0)