File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -16,19 +16,18 @@ Middleware.auth = function (ctx) {
1616
1717 const { login, callback } = ctx . $auth . options . redirect
1818 const pageIsInGuestMode = routeOption ( ctx . route , 'auth' , 'guest' )
19- const insideLoginPage = normalizePath ( ctx . route . path ) === normalizePath ( login )
20- const insideCallbackPage = normalizePath ( ctx . route . path ) !== normalizePath ( callback )
19+ const insidePage = page => normalizePath ( ctx . route . path ) === normalizePath ( page )
2120
2221 if ( ctx . $auth . $state . loggedIn ) {
2322 // -- Authorized --
24- if ( ! login || insideLoginPage || pageIsInGuestMode ) {
23+ if ( ! login || insidePage ( login ) || pageIsInGuestMode ) {
2524 ctx . $auth . redirect ( 'home' )
2625 }
2726 } else {
2827 // -- Guest --
2928 // (Those passing `callback` at runtime need to mark their callback component
3029 // with `auth: false` to avoid an unnecessary redirect from callback to login)
31- if ( ! pageIsInGuestMode && ( ! callback || insideCallbackPage ) ) {
30+ if ( ! pageIsInGuestMode && ( ! callback || ! insidePage ( callback ) ) ) {
3231 ctx . $auth . redirect ( 'login' )
3332 }
3433 }
You can’t perform that action at this time.
0 commit comments