-
Notifications
You must be signed in to change notification settings - Fork 266
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
Simplify Authenticated Middleware #11096
Conversation
…uthenticated middleware We didn't actually need to call redirect from the methods since the `loadingError` store action did the redirect for us. We still need to exit early from the middleware so instead of having to check and execute a return value (that was a boolean so couldn't be executed anyway) we now just throw an exception.
1c378ce
to
12b6b6b
Compare
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.
Glad to see something more readable and with comments 😄
Beside 2 notes, the rest is fine to me.
Thanks for adding the comment about the WIP!
|
||
store.dispatch('loadingError', new Error(store.getters['i18n/t']('nav.failWhale.resourceNotFound', { resource }, true))); | ||
|
||
return () => redirect(302, '/fail-whale'); |
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.
Sorry for asking, but I got completely lost from our prior logic and I'm glad you simplified 😅
Is this redirect not necessary anymore, though? I could not find any matching redirect to '/fail-whale'
so I just wanted to be sure that was not a mistake.
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.
Yeah, the loadingError
action actually does the redirect.
Line 578 in d20719b
router.replace('/fail-whale'); |
|
||
// ************************************************************ | ||
// | ||
// BELOW ARE METHODS THAT ARE A PART OF THE AUTHENTICATED MIDDLEWARE REMOVAL. THIS IS A TEMPORARY HOME FOR THESE UTILS AND SHOULD BE REWRITTEN, MOVED OR DELETED. |
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.
Thanks for mentioning that this is the first clean round.
If you are not planning to work on it, would it be ok to add an issue with a TODO, so we can track it down?
Otherwise is enough for the next PR as usual.
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.
Updated the code and added an issue #11111
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.
Thanks and nice number 😅
12b6b6b
to
a193b53
Compare
a193b53
to
468f296
Compare
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
|
||
// ************************************************************ | ||
// | ||
// BELOW ARE METHODS THAT ARE A PART OF THE AUTHENTICATED MIDDLEWARE REMOVAL. THIS IS A TEMPORARY HOME FOR THESE UTILS AND SHOULD BE REWRITTEN, MOVED OR DELETED. |
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.
Thanks and nice number 😅
Summary
Small rework of two functions and then the extraction of a number of functions to the existing auth util. This is an effort to shrink down the code in authenticated middleware to make it a little easier to address.
It might be helpful to look at the two commits in this PR separately.
Areas or cases that should be tested
Screenshot/Video
auth-slim.mp4
Checklist