-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix: Redirect to login page when receiving 401 unauthorized response from API #1373
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes authentication handling by correcting the router guard parameter order and improving 401 unauthorized response handling. The changes ensure users are properly redirected to the login page when their session expires.
- Fixed router guard parameters from incorrect
(from, to, next)to correct(to, from, next)order - Moved 401 error handling from success response handler to error response handler where it belongs
- Added comprehensive redirect logic with fallback to window.location.href
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ui-vue3/src/main.ts | Fixed router guard parameter order and path check logic; removed unused imports |
| ui-vue3/src/base/http/request.ts | Relocated 401 handling to error interceptor with redirect logic and necessary imports |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…d enhance error logging - Introduced new JavaScript files for YAML and XML syntax highlighting and editing capabilities. - Added a new component for updating YAML configurations with a structured editor interface. - Updated the index.html to reference the new JavaScript bundle for improved functionality. - Enhanced the HTTP request module to log errors during redirection on 401 responses for better debugging.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 87 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
robocanic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.



Please provide a description of this PR:
main.ts- Fixed router guard implementationrequest.ts- Added 401 redirect logic to HTTP interceptorTo help us figure out who should review this PR, please put an X in all the areas that this PR affects.
Please check any characteristics that apply to this pull request.