-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Make logout function more robust to prevent session issues #11361
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
base: 4.20
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -472,9 +472,17 @@ const user = { | |||||||
}).catch(() => { | ||||||||
resolve() | ||||||||
}).finally(() => { | ||||||||
const paths = ['/', '/client'] | ||||||||
const hostname = window.location.hostname | ||||||||
const domains = [undefined, hostname, `.${hostname}`] | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] The domains array construction could be simplified and made more readable by extracting the dot-prefixed hostname to a separate variable, e.g.,
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||
Object.keys(Cookies.get()).forEach(cookieName => { | ||||||||
Cookies.remove(cookieName) | ||||||||
Cookies.remove(cookieName, { path: '/client' }) | ||||||||
paths.forEach(path => { | ||||||||
domains.forEach(domain => { | ||||||||
const options = { path } | ||||||||
if (domain) options.domain = domain | ||||||||
Cookies.remove(cookieName, options) | ||||||||
}) | ||||||||
}) | ||||||||
}) | ||||||||
}) | ||||||||
}) | ||||||||
|
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.
[nitpick] Consider extracting the hardcoded paths array to a configuration constant or module-level variable to improve maintainability and make it easier to modify these paths in the future.
Copilot uses AI. Check for mistakes.