fix: clear auth on 401 API responses#1152
Merged
theborakompanioni merged 3 commits intojoinmarket-webui:v2from Apr 12, 2026
Merged
fix: clear auth on 401 API responses#1152theborakompanioni merged 3 commits intojoinmarket-webui:v2from
theborakompanioni merged 3 commits intojoinmarket-webui:v2from
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a response interceptor to handle 401 Unauthorized API responses by automatically clearing the authentication state and query cache. This prevents the UI from getting stuck in a broken state when tokens become stale (e.g., after laptop sleep or browser throttling), ensuring users are redirected to the login page.
Changes:
- Added
unauthorizedResponseInterceptorfunction that clears auth state and query cache on 401 responses - Registered the response interceptor in the API client setup
- Imported
queryClientfrom./queryClientto enable cache clearing
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
theborakompanioni
approved these changes
Feb 25, 2026
theborakompanioni
pushed a commit
that referenced
this pull request
Apr 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a response interceptor that clears auth state and query cache when the backend returns 401. Previously stale tokens after laptop sleep or browser throttle left the UI in a broken state instead of redirecting to login.