diff --git a/awx/ui/src/App.js b/awx/ui/src/App.js index a1e1dc1dc9..ab0211bd38 100644 --- a/awx/ui/src/App.js +++ b/awx/ui/src/App.js @@ -103,7 +103,11 @@ const ProtectedRoute = ({ children, ...rest }) => { const location = useLocation(); useEffect(() => { - setAuthRedirectTo(authRedirectTo === '/logout' ? '/' : pathname); + setAuthRedirectTo( + authRedirectTo === '/logout' + ? '/' + : `${location.pathname}${location.search}` + ); }); if (isAuthenticated(document.cookie)) { @@ -116,12 +120,6 @@ const ProtectedRoute = ({ children, ...rest }) => { ); } - setAuthRedirectTo( - authRedirectTo === '/logout' - ? '/' - : `${location.pathname}${location.search}` - ); - return ; };