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(admin-ui): Fix sign out in admin panel not redirecting correctly #4837

Merged
merged 4 commits into from
Aug 23, 2023

Conversation

StephixOne
Copy link
Contributor

@StephixOne StephixOne commented Aug 23, 2023

What/Why
Signing out from the user menu appeared to land you on the orders page, though any requests to the API would 401, landing you on a "broken" admin panel

How
The culprit turned out to be the user object from useAdminGetSession sticking around, stale, after the useAdminDeleteSession mutation was called, as the refetch would fail. Thus, when the redirect to /login happened, this page would see there was a user on the session and redirect you to /. Used the remove method from the useAdminGetSession hook to ensure the stale user session data is removed from there, so that the login component doesn't automatically redirect anywhere.

Resolves CORE-1471.

@StephixOne StephixOne requested a review from a team as a code owner August 23, 2023 11:53
@changeset-bot
Copy link

changeset-bot bot commented Aug 23, 2023

🦋 Changeset detected

Latest commit: 78e2f21

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@medusajs/admin-ui Patch
@medusajs/admin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Aug 23, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Visit Preview Aug 23, 2023 7:40pm
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Aug 23, 2023 7:40pm

Copy link
Contributor

@olivermrbl olivermrbl left a comment

Choose a reason for hiding this comment

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

lgtm, nice catch!

@olivermrbl olivermrbl merged commit 57e199e into develop Aug 23, 2023
@github-actions github-actions bot mentioned this pull request Aug 23, 2023
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.

2 participants